responsetest

package
v0.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertError

func AssertError(t *testing.T, resp *httptest.ResponseRecorder) (err error)

AssertError will assert error

Example
t := &testing.T{}
recorder := httptest.NewRecorder()
request, err := http.NewRequest("POST", "http://here.com/v1/signin", nil)
if err != nil {
	panic(err)
}
response.InternalServerError(request, recorder, errors.New("Failed to do something"))
AssertError(t, recorder)
Output:

func AssertErrorMessage

func AssertErrorMessage(t *testing.T, resp *httptest.ResponseRecorder, msg string) (err error)

AssertErrorMessage will assert error message

Example
t := &testing.T{}
recorder := httptest.NewRecorder()
request, err := http.NewRequest("POST", "http://here.com/v1/signin", nil)
if err != nil {
	panic(err)
}
response.InternalServerError(request, recorder, errors.New("Failed to do something"))
AssertErrorMessage(t, recorder, "Failed to do something")
Output:

func AssertStatusEqual

func AssertStatusEqual(t *testing.T, resp *httptest.ResponseRecorder, status int)

AssertStatusEqual will assert equal status

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL