MCPcopy Create free account
hub / github.com/CPChain/chain / testHTTPErrorResponse

Function testHTTPErrorResponse

api/rpc/http_test.go:48–54  ·  view source on GitHub ↗
(t *testing.T, method, contentType, body string, expected int)

Source from the content-addressed store, hash-verified

46}
47
48func testHTTPErrorResponse(t *testing.T, method, contentType, body string, expected int) {
49 request := httptest.NewRequest(method, "http://url.com", strings.NewReader(body))
50 request.Header.Set("content-type", contentType)
51 if code, _ := validateRequest(request); code != expected {
52 t.Fatalf("response code should be %d not %d", expected, code)
53 }
54}

Calls 2

validateRequestFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected