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:
parent
a7a04ebe7b
commit
d64b0f81c9
1 changed files with 5 additions and 0 deletions
|
@ -294,6 +294,11 @@ func (t *TransformingTransport) RoundTrip(req *http.Request) (*http.Response, er
|
||||||
return nil, err
|
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()
|
defer resp.Body.Close()
|
||||||
b, err := ioutil.ReadAll(resp.Body)
|
b, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue