File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
lib/action_dispatch/middleware Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ def find_file(path_info, accept_encoding:)
108
108
end
109
109
110
110
def try_files ( filepath , content_type , accept_encoding :)
111
- headers = { "content-type" => content_type }
111
+ headers = { Rack :: CONTENT_TYPE => content_type }
112
112
113
113
if compressible? content_type
114
114
try_precompressed_files filepath , headers , accept_encoding : accept_encoding
Original file line number Diff line number Diff line change @@ -199,6 +199,18 @@ def test_does_not_modify_path_info
199
199
assert_equal file_name , env [ "PATH_INFO" ]
200
200
end
201
201
202
+ def test_only_set_one_content_type
203
+ file_name = "/gzip/foo.zoo"
204
+ gzip_env = { "PATH_INFO" => file_name , "HTTP_ACCEPT_ENCODING" => "gzip" , "REQUEST_METHOD" => "GET" }
205
+ response = @app . call ( gzip_env )
206
+
207
+ env = { "PATH_INFO" => file_name , "REQUEST_METHOD" => "GET" }
208
+ default_response = @app . call ( env )
209
+
210
+ assert_equal 1 , response [ 1 ] . slice ( "Content-Type" , "content-type" ) . size
211
+ assert_equal 1 , default_response [ 1 ] . slice ( "Content-Type" , "content-type" ) . size
212
+ end
213
+
202
214
def test_serves_gzip_with_proper_content_type_fallback
203
215
file_name = "/gzip/foo.zoo"
204
216
response = get ( file_name , "HTTP_ACCEPT_ENCODING" => "gzip" )
You can’t perform that action at this time.
0 commit comments