diff options
Diffstat (limited to 'libgo/go/net/http/response.go')
-rw-r--r-- | libgo/go/net/http/response.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libgo/go/net/http/response.go b/libgo/go/net/http/response.go index 7901c49..9a7e4e3 100644 --- a/libgo/go/net/http/response.go +++ b/libgo/go/net/http/response.go @@ -46,6 +46,9 @@ type Response struct { // The http Client and Transport guarantee that Body is always // non-nil, even on responses without a body or responses with // a zero-lengthed body. + // + // The Body is automatically dechunked if the server replied + // with a "chunked" Transfer-Encoding. Body io.ReadCloser // ContentLength records the length of the associated content. The @@ -198,9 +201,7 @@ func (r *Response) Write(w io.Writer) error { } protoMajor, protoMinor := strconv.Itoa(r.ProtoMajor), strconv.Itoa(r.ProtoMinor) statusCode := strconv.Itoa(r.StatusCode) + " " - if strings.HasPrefix(text, statusCode) { - text = text[len(statusCode):] - } + text = strings.TrimPrefix(text, statusCode) io.WriteString(w, "HTTP/"+protoMajor+"."+protoMinor+" "+statusCode+text+"\r\n") // Process Body,ContentLength,Close,Trailer |