1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/lib/action_dispatch/middleware/best_standards_support.rb
Nikita Afanasenko d8c1404107 Fix #8086 (BestStandardsSupport rewrites app X-UA-Compatible header, now appends).
Now `BestStandardsSupport` middleware appends it's `X-UA-Compatible` value to app's value.
Also test for `BestStandardsSupport` middleware added.
2012-11-01 15:15:46 +04:00

28 lines
545 B
Ruby

module ActionDispatch
class BestStandardsSupport
def initialize(app, type = true)
@app = app
@header = case type
when true
"IE=Edge,chrome=1"
when :builtin
"IE=Edge"
when false
nil
end
end
def call(env)
status, headers, body = @app.call(env)
if headers["X-UA-Compatible"] && @header
headers["X-UA-Compatible"] << "," << @header.to_s
else
headers["X-UA-Compatible"] = @header
end
[status, headers, body]
end
end
end