Merge pull request #222 from samueleaton/master

Remove Content-Type response header if the file is cached
This commit is contained in:
Serdar Dogruyol 2016-10-12 11:31:20 +03:00 committed by GitHub
commit 450dab9f81
1 changed files with 1 additions and 0 deletions

View File

@ -80,6 +80,7 @@ module Kemal
etag = %{W/"#{File.lstat(file_path).mtime.epoch.to_s}"}
context.response.headers["ETag"] = etag
return false if !context.request.headers["If-None-Match"]? || context.request.headers["If-None-Match"] != etag
context.response.headers.delete "Content-Type"
context.response.content_length = 0
context.response.status_code = 304 # not modified
return true