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

Function HTTPStatusCode

require/require.go:785–793  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

783//
784// Returns whether the assertion was successful (true) or not (false).
785func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) {
786 if h, ok := t.(tHelper); ok {
787 h.Helper()
788 }
789 if assert.HTTPStatusCode(t, handler, method, url, values, statuscode, msgAndArgs...) {
790 return
791 }
792 t.FailNow()
793}
794
795// HTTPStatusCodef asserts that a specified handler returns a specified status code.
796//

Callers 1

HTTPStatusCodeMethod · 0.70

Calls 3

HTTPStatusCodeFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by

no test coverage detected