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

return 304 from TransformingTransport

If the caching headers in the request are valid, return a 304 response
instead of doing the transformation.

Ref #92
This commit is contained in:
Will Norris 2017-06-14 20:04:41 -04:00
parent a7a04ebe7b
commit d64b0f81c9

View file

@ -294,6 +294,11 @@ func (t *TransformingTransport) RoundTrip(req *http.Request) (*http.Response, er
return nil, err
}
if should304(req, resp) {
// bare 304 response, full response will be used from cache
return &http.Response{StatusCode: http.StatusNotModified}, nil
}
defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body)
if err != nil {