aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/static.rb
diff options
context:
space:
mode:
authorKohei Suzuki <eagletmt@gmail.com>2015-03-10 16:51:51 +0900
committerKohei Suzuki <eagletmt@gmail.com>2015-03-10 23:39:08 +0900
commitd4103fc232044625c6ba4692b4c9bd8779e97ba5 (patch)
treebb6475ff3928e412b69347b31bf9d10e772651e5 /actionpack/lib/action_dispatch/middleware/static.rb
parent221e847a3bc4b6dc2559b4354417862b2e6c684a (diff)
downloadrails-d4103fc232044625c6ba4692b4c9bd8779e97ba5.tar.gz
rails-d4103fc232044625c6ba4692b4c9bd8779e97ba5.tar.bz2
rails-d4103fc232044625c6ba4692b4c9bd8779e97ba5.zip
304 response should not include Content-Type header
Rack::Lint raises an error saying "Content-Type header found in 304 response, not allowed".
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/static.rb')
-rw-r--r--actionpack/lib/action_dispatch/middleware/static.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/static.rb b/actionpack/lib/action_dispatch/middleware/static.rb
index 2e1bd45c3d..f5c2acbfb9 100644
--- a/actionpack/lib/action_dispatch/middleware/static.rb
+++ b/actionpack/lib/action_dispatch/middleware/static.rb
@@ -48,7 +48,9 @@ module ActionDispatch
env['PATH_INFO'] = gzip_path
status, headers, body = @file_server.call(env)
headers['Content-Encoding'] = 'gzip'
- headers['Content-Type'] = content_type(path)
+ if status != 304
+ headers['Content-Type'] = content_type(path)
+ end
else
status, headers, body = @file_server.call(env)
end