mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
d8c1404107
Now `BestStandardsSupport` middleware appends it's `X-UA-Compatible` value to app's value. Also test for `BestStandardsSupport` middleware added.
28 lines
545 B
Ruby
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
|