-
Notifications
You must be signed in to change notification settings - Fork 21.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8093 from nikitug/keep_app_x_ua_compatible
Fix #8086 (BestStandardsSupport rewrites app X-UA-Compatible header) Conflicts: actionpack/CHANGELOG.md
- Loading branch information
1 parent
3d25292
commit 90a5ec7
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'abstract_unit' | ||
|
||
class BestStandardsSupportTest < ActiveSupport::TestCase | ||
def test_with_best_standards_support | ||
_, headers, _ = app(true, {}).call({}) | ||
assert_equal "IE=Edge,chrome=1", headers["X-UA-Compatible"] | ||
end | ||
|
||
def test_with_builtin_best_standards_support | ||
_, 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 | ||
|
||
private | ||
|
||
def app(type, headers) | ||
app = proc { [200, headers, "response"] } | ||
ActionDispatch::BestStandardsSupport.new(app, type) | ||
end | ||
|
||
end |