Http
Asserting HTTP Response And Body
Assertions
All links point to https://pkg.go.dev/github.com/go-openapi/testify/v2
This domain exposes 7 functionalities.
HTTPBodyContains
HTTPBodyContains asserts that a specified handler returns a body that contains a string.
Returns whether the assertion was successful (true) or not (false).
HTTPBodyNotContains
HTTPBodyNotContains asserts that a specified handler returns a body that does not contain a string.
Returns whether the assertion was successful (true) or not (false).
HTTPError
HTTPError asserts that a specified handler returns an error status code.
Returns whether the assertion was successful (true) or not (false).
HTTPRedirect
HTTPRedirect asserts that a specified handler returns a redirect status code.
Returns whether the assertion was successful (true) or not (false).
HTTPStatusCode
HTTPStatusCode asserts that a specified handler returns a specified status code.
Returns whether the assertion was successful (true) or not (false).
HTTPSuccess
HTTPSuccess asserts that a specified handler returns a success status code.
Returns whether the assertion was successful (true) or not (false).
Other helpers
HTTPBody
HTTPBody is a helper that returns the HTTP body of the response. It returns the empty string if building a new request fails.
| Signature | Usage |
|---|---|
assert.HTTPBody(handler http.HandlerFunc, method string, url string, values url.Values) string | package-level function |
| Signature | Usage |
|---|---|
require.HTTPBody(handler http.HandlerFunc, method string, url string, values url.Values) string | package-level function |
| Signature | Usage |
|---|---|
assertions.HTTPBody(handler http.HandlerFunc, method string, url string, values url.Values) string | internal implementation |
Source: github.com/go-openapi/testify/v2/internal/assertions#HTTPBody
Generated with github.com/go-openapi/testify/v2/codegen