mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-24 20:36:24 +02: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
|
||||
}
|
||||
|
||||
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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue