MCPcopy
hub / github.com/caddyserver/caddy / AssertPatchResponseBody

Method AssertPatchResponseBody

caddytest/caddytest.go:599–611  ·  view source on GitHub ↗

AssertPatchResponseBody requests a URI with PATCH and asserts the response code and body.

(requestURI string, requestHeaders []string, requestBody *bytes.Buffer, expectedStatusCode int, expectedBody string)

Source from the content-addressed store, hash-verified

597
598// AssertPatchResponseBody requests a URI with PATCH and asserts the response code and body.
599func (tc *Tester) AssertPatchResponseBody(requestURI string, requestHeaders []string, requestBody *bytes.Buffer, expectedStatusCode int, expectedBody string) (*http.Response, string) {
600 tc.t.Helper()
601
602 req, err := http.NewRequest("PATCH", requestURI, requestBody)
603 if err != nil {
604 tc.t.Errorf("failed to create request %s", err)
605 return nil, ""
606 }
607
608 applyHeaders(tc.t, req, requestHeaders)
609
610 return tc.AssertResponse(req, expectedStatusCode, expectedBody)
611}

Callers 1

TestCheckIDFunction · 0.95

Calls 2

AssertResponseMethod · 0.95
applyHeadersFunction · 0.85

Tested by 1

TestCheckIDFunction · 0.76