0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00

include non-nil body in bare 304 response

This commit is contained in:
Will Norris 2017-06-17 12:45:15 -04:00
parent 038e10f436
commit 1fcd100d16

View file

@ -35,6 +35,8 @@ import (
tphttp "willnorris.com/go/imageproxy/third_party/http"
)
var emptyBody io.ReadCloser = ioutil.NopCloser(new(bytes.Buffer))
// Proxy serves image requests.
type Proxy struct {
Client *http.Client // client used to fetch remote URLs
@ -305,7 +307,7 @@ func (t *TransformingTransport) RoundTrip(req *http.Request) (*http.Response, er
if should304(req, resp) {
// bare 304 response, full response will be used from cache
return &http.Response{StatusCode: http.StatusNotModified}, nil
return &http.Response{StatusCode: http.StatusNotModified, Body: emptyBody}, nil
}
defer resp.Body.Close()