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

Function HTTPErrorf

require/require.go:754–762  ·  view source on GitHub ↗

HTTPErrorf asserts that a specified handler returns an error status code. require.HTTPErrorf(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, msg string, args ...interface{})

Source from the content-addressed store, hash-verified

752//
753// Returns whether the assertion was successful (true) or not (false).
754func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
755 if h, ok := t.(tHelper); ok {
756 h.Helper()
757 }
758 if assert.HTTPErrorf(t, handler, method, url, values, msg, args...) {
759 return
760 }
761 t.FailNow()
762}
763
764// HTTPRedirect asserts that a specified handler returns a redirect status code.
765//

Callers 1

HTTPErrorfMethod · 0.70

Calls 3

HTTPErrorfFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by

no test coverage detected