MCPcopy
hub / github.com/expr-lang/expr / HTTPBodyNotContains

Function HTTPBodyNotContains

internal/testify/assert/http_assertions.go:153–165  ·  view source on GitHub ↗

HTTPBodyNotContains asserts that a specified handler returns a body that does not contain a string. assert.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") Returns whether the assertion was successful (true) or not (false).

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

Source from the content-addressed store, hash-verified

151//
152// Returns whether the assertion was successful (true) or not (false).
153func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
154 if h, ok := t.(tHelper); ok {
155 h.Helper()
156 }
157 body := HTTPBody(handler, method, url, values)
158
159 contains := strings.Contains(body, fmt.Sprint(str))
160 if contains {
161 Fail(t, fmt.Sprintf("Expected response body for \"%s\" to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...)
162 }
163
164 return !contains
165}

Callers 4

HTTPBodyNotContainsFunction · 0.92
HTTPBodyNotContainsfFunction · 0.70
TestHttpBodyFunction · 0.70
HTTPBodyNotContainsMethod · 0.70

Calls 6

HTTPBodyFunction · 0.85
SprintMethod · 0.80
SprintfMethod · 0.80
FailFunction · 0.70
HelperMethod · 0.45
ContainsMethod · 0.45

Tested by 1

TestHttpBodyFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…