lib/roda/plugins/public.rb in roda-3.4.0 vs lib/roda/plugins/public.rb in roda-3.5.0
- old
+ new
@@ -70,13 +70,15 @@
if public_file_readable?(gzip_path)
res = public_serve(server, gzip_path)
headers = res[1]
- if mime_type = ::Rack::Mime.mime_type(::File.extname(path), 'text/plain')
- headers['Content-Type'] = mime_type
+ unless res[0] == 304
+ if mime_type = ::Rack::Mime.mime_type(::File.extname(path), 'text/plain')
+ headers['Content-Type'] = mime_type
+ end
+ headers['Content-Encoding'] = 'gzip'
end
- headers['Content-Encoding'] = 'gzip'
halt res
end
end