jarcoal/httpmock

Use http status number with text code instead of just the status number as a string

amasare opened this issue · 3 comments

Status: strconv.Itoa(status),

According to https://golang.org/src/net/http/response.go?s=731:4298#L25 the http Response object should return the http status number as well as the status text. So

&http.Response{
		Status:        strconv.Itoa(status),
		StatusCode:    status,
		Body:          NewRespBodyFromString(body),
		Header:        http.Header{},
		ContentLength: -1,
	}

should be

		Status:        strconv.Itoa(status) + " " + http.StatusText(status),
		StatusCode:    status,
		Body:          NewRespBodyFromString(body),
		Header:        http.Header{},
		ContentLength: -1,
	}

If you want this feature to be really useful, please file a PR on v1 branch. master branch is deprecated now.