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

Function HTTPStatusCode

require/require.go:799–807  ·  require/require.go::HTTPStatusCode

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

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

Callers 1

HTTPStatusCodeMethod · 0.70

Calls 3

HTTPStatusCodeFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by

no test coverage detected