Fix #8086 (BestStandardsSupport rewrites app X-UA-Compatible header) #8093

Merged
merged 1 commit into from Nov 1, 2012

Projects

None yet

2 participants

@nikitug
nikitug commented Nov 1, 2012

Now BestStandardsSupport middleware appends it's X-UA-Compatible value to app's value.
Also test for BestStandardsSupport middleware added.

@nikitug
nikitug commented Nov 1, 2012

Will probably need a 3.2 backport

@carlosantoniodasilva

Looks good. It needs a changelog entry, thanks!

@nikitug nikitug 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.
d8c1404
@nikitug
nikitug commented Nov 1, 2012

@carlosantoniodasilva thanks, done. Do it need a backport?

@carlosantoniodasilva carlosantoniodasilva commented on the diff Nov 1, 2012
actionpack/test/dispatch/best_standards_support_test.rb
+ _, headers, _ = app(:builtin, {}).call({})
+ assert_equal "IE=Edge", headers["X-UA-Compatible"]
+ end
+
+ def test_without_best_standards_support
+ _, headers, _ = app(false, {}).call({})
+ assert_equal nil, headers["X-UA-Compatible"]
+ end
+
+ def test_appends_to_app_headers
+ app_headers = { "X-UA-Compatible" => "requiresActiveX=true" }
+ _, headers, _ = app(true, app_headers).call({})
+
+ expects = "requiresActiveX=true,IE=Edge,chrome=1"
+ assert_equal expects, headers["X-UA-Compatible"]
+ end
@carlosantoniodasilva
carlosantoniodasilva Nov 1, 2012 Ruby on Rails member

What happens if you give it false, but has X-UA-Compatible set in the app? Will it override the users' value?

@carlosantoniodasilva
carlosantoniodasilva Nov 1, 2012 Ruby on Rails member

Anyway, don't worry, the middleware is not added if the config is false.

@carlosantoniodasilva carlosantoniodasilva merged commit 69cebae into rails:master Nov 1, 2012
@carlosantoniodasilva

@nikitug I think it can be backported without problem yeah, but we will need to wait until 3.2.9 is released. Thanks!

@carlosantoniodasilva

Backported in 90a5ec7, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment