File tree 1 file changed +7
-5
lines changed
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 1
1
module Rack
2
2
module PactBroker
3
-
4
3
# If the HTML and the CSV group resources are both requested by the browser,
5
4
# Chrome gets confused by the content types, and when you click back, it tries to load the CSV
6
5
# instead of the HTML page. So we have to give the CSV resource a different URL (.csv)
7
6
8
7
class ConvertFileExtensionToAcceptHeader
9
8
10
- EXTENSIONS = { ".csv" => "text/csv" , ".svg" => "image/svg+xml" , ".json" => "application/hal+json" }
11
- EXTENSION_REGEXP = /\. \w +$/
9
+ EXTENSION_REGEXP = /\. \w +$/ . freeze
10
+ EXTENSIONS = {
11
+ ".csv" => "text/csv" ,
12
+ ".svg" => "image/svg+xml" ,
13
+ ".json" => "application/hal+json" ,
14
+ ".yaml" => "application/x-yaml"
15
+ }
12
16
13
17
def initialize app
14
18
@app = app
@@ -37,8 +41,6 @@ def set_accept_header_and_path_info env, file_extension
37
41
"HTTP_ACCEPT" => EXTENSIONS [ file_extension ]
38
42
)
39
43
end
40
-
41
44
end
42
-
43
45
end
44
46
end
You can’t perform that action at this time.
0 commit comments