MCPcopy Create free account
hub / github.com/stretchr/testify / HTTPError

Function HTTPError

require/require.go:725–733  ·  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

723//
724// Returns whether the assertion was successful (true) or not (false).
725func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
726 if h, ok := t.(tHelper); ok {
727 h.Helper()
728 }
729 if assert.HTTPError(t, handler, method, url, values, msgAndArgs...) {
730 return
731 }
732 t.FailNow()
733}
734
735// HTTPErrorf asserts that a specified handler returns an error status code.
736//

Callers 1

HTTPErrorMethod · 0.70

Calls 3

HTTPErrorFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by

no test coverage detected