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

Function HTTPStatusCodef

require/require.go:800–808  ·  view source on GitHub ↗

HTTPStatusCodef asserts that a specified handler returns a specified status code. require.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") Returns whether the assertion was successful (true) or not (false).

(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{})

Source from the content-addressed store, hash-verified

798//
799// Returns whether the assertion was successful (true) or not (false).
800func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) {
801 if h, ok := t.(tHelper); ok {
802 h.Helper()
803 }
804 if assert.HTTPStatusCodef(t, handler, method, url, values, statuscode, msg, args...) {
805 return
806 }
807 t.FailNow()
808}
809
810// HTTPSuccess asserts that a specified handler returns a success status code.
811//

Callers 1

HTTPStatusCodefMethod · 0.70

Calls 3

HTTPStatusCodefFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by

no test coverage detected