You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ServeHTTP should close the response body before returning.
What did you see instead?
ServeHTTP does not defer the call to close the response body, in order to populate response trailers.
If ModifyResponse returns an error, ServeHTTP returns before closing the response body.
I'll prepare a CL if desired.
The text was updated successfully, but these errors were encountered:
…d requests
Previously when RoundTrip returned a non-nil error, the proxy returned a
StatusBadGateway error, instead of first calling ModifyResponse. This
commit first calls ModifyResponse, whether or not the error returned
from RoundTrip is nil.
Also closes response body when ModifyResponse returns an error. See #22658.
Fixes#21255
Change-Id: I5b5bf23a69ae5608f87d4ece756a1b4985ccaa9c
Reviewed-on: https://go-review.googlesource.com/54030
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
What version of Go are you using (
go version
)?go version go1.9.2 linux/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?What did you do?
Return an error from
ReverseProxy
'sModifyResponse
function.Test: https://play.golang.org/p/8N8zeMvox5
What did you expect to see?
ServeHTTP
should close the response body before returning.What did you see instead?
ServeHTTP
does not defer the call to close the response body, in order to populate response trailers.If
ModifyResponse
returns an error,ServeHTTP
returns before closing the response body.I'll prepare a CL if desired.
The text was updated successfully, but these errors were encountered: