status 304 (not modified)

This commit is contained in:
Nazar Kanaev 2020-08-20 11:29:38 +01:00
parent 4f6e9e5c7c
commit 06458065d6

View File

@ -108,6 +108,10 @@ func StaticHandler(rw http.ResponseWriter, req *http.Request) {
if assets != nil { if assets != nil {
if asset, ok := assets[path]; ok { if asset, ok := assets[path]; ok {
if req.Header.Get("if-none-match") == asset.etag {
rw.WriteHeader(http.StatusNotModified)
return
}
rw.Header().Set("Content-Type", ctype) rw.Header().Set("Content-Type", ctype)
rw.Header().Set("Content-Encoding", "gzip") rw.Header().Set("Content-Encoding", "gzip")
rw.Header().Set("Etag", asset.etag) rw.Header().Set("Etag", asset.etag)