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

Function HTTPStatusCodef

require/require.go:814–822  ·  require/require.go::HTTPStatusCodef

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

812//
813// Returns whether the assertion was successful (true) or not (false).
814func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) {
815 if h, ok := t.(tHelper); ok {
816 h.Helper()
817 }
818 if assert.HTTPStatusCodef(t, handler, method, url, values, statuscode, msg, args...) {
819 return
820 }
821 t.FailNow()
822}
823
824// HTTPSuccess asserts that a specified handler returns a success status code.
825//

Callers 1

HTTPStatusCodefMethod · 0.70

Calls 3

HTTPStatusCodefFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by

no test coverage detected