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

Function HTTPErrorf

require/require.go:740–748  ·  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

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

Callers 1

HTTPErrorfMethod · 0.70

Calls 3

HTTPErrorfFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by

no test coverage detected