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

Method AssertGetResponse

caddytest/caddytest.go:545–554  ·  view source on GitHub ↗

Verb specific test functions AssertGetResponse requests a URI with GET and expects a status code and body text.

(requestURI string, expectedStatusCode int, expectedBody string)

Source from the content-addressed store, hash-verified

543
544// AssertGetResponse requests a URI with GET and expects a status code and body text.
545func (tc *Tester) AssertGetResponse(requestURI string, expectedStatusCode int, expectedBody string) (*http.Response, string) {
546 tc.t.Helper()
547
548 req, err := http.NewRequest("GET", requestURI, nil)
549 if err != nil {
550 tc.t.Fatalf("unable to create request %s", err)
551 }
552
553 return tc.AssertResponse(req, expectedStatusCode, expectedBody)
554}
555
556// AssertDeleteResponse requests a URI with DELETE and expects a status code and body text.
557func (tc *Tester) AssertDeleteResponse(requestURI string, expectedStatusCode int, expectedBody string) (*http.Response, string) {

Calls 1

AssertResponseMethod · 0.95