diff --git a/response.go b/response.go index 75378c4..4e2c666 100644 --- a/response.go +++ b/response.go @@ -525,7 +525,7 @@ func NewNotFoundResponder(fn func(...any)) Responder { // httpmock.NewStringResponse(200, httpmock.File("body.txt").String()) func NewStringResponse(status int, body string) *http.Response { return &http.Response{ - Status: strconv.Itoa(status), + Status: fmt.Sprintf("%03d %s", status, http.StatusText(status)), StatusCode: status, Body: NewRespBodyFromString(body), Header: http.Header{}, @@ -551,7 +551,7 @@ func NewStringResponder(status int, body string) Responder { // httpmock.NewBytesResponse(200, httpmock.File("body.raw").Bytes()) func NewBytesResponse(status int, body []byte) *http.Response { return &http.Response{ - Status: strconv.Itoa(status), + Status: fmt.Sprintf("%03d %s", status, http.StatusText(status)), StatusCode: status, Body: NewRespBodyFromBytes(body), Header: http.Header{}, diff --git a/response_test.go b/response_test.go index a34915b..9c828d5 100644 --- a/response_test.go +++ b/response_test.go @@ -712,7 +712,7 @@ func TestResponder_HeaderAddSet(t *testing.T) { orig := httpmock.NewStringResponder(200, "body") origNilHeader := httpmock.ResponderFromResponse(&http.Response{ - Status: "200", + Status: "200 OK", StatusCode: 200, Body: httpmock.NewRespBodyFromString("body"), ContentLength: -1,