MCPcopy
hub / github.com/stretchr/testify / HTTPError

Function HTTPError

require/require.go:739–747  ·  view source on GitHub ↗

HTTPError asserts that a specified handler returns an error status code. require.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} Returns whether the assertion was successful (true) or not (false).

(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

737//
738// Returns whether the assertion was successful (true) or not (false).
739func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
740 if h, ok := t.(tHelper); ok {
741 h.Helper()
742 }
743 if assert.HTTPError(t, handler, method, url, values, msgAndArgs...) {
744 return
745 }
746 t.FailNow()
747}
748
749// HTTPErrorf asserts that a specified handler returns an error status code.
750//

Callers 1

HTTPErrorMethod · 0.70

Calls 3

HTTPErrorFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by

no test coverage detected