mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Include application/javascript when checking content_type
This commit is contained in:
parent
17bf62033e
commit
d3a2c53955
2 changed files with 6 additions and 1 deletions
|
@ -275,7 +275,7 @@ module ActionController #:nodoc:
|
|||
|
||||
# Check for cross-origin JavaScript responses.
|
||||
def non_xhr_javascript_response? # :doc:
|
||||
content_type =~ %r(\Atext/javascript) && !request.xhr?
|
||||
content_type =~ %r(\A(text|application)/javascript) && !request.xhr?
|
||||
end
|
||||
|
||||
AUTHENTICITY_TOKEN_LENGTH = 32
|
||||
|
|
|
@ -521,6 +521,11 @@ module RequestForgeryProtectionTests
|
|||
get :negotiate_same_origin
|
||||
end
|
||||
|
||||
assert_cross_origin_blocked do
|
||||
@request.accept = "application/javascript"
|
||||
get :negotiate_same_origin
|
||||
end
|
||||
|
||||
assert_cross_origin_not_blocked { get :same_origin_js, xhr: true }
|
||||
assert_cross_origin_not_blocked { get :same_origin_js, xhr: true, format: "js" }
|
||||
assert_cross_origin_not_blocked do
|
||||
|
|
Loading…
Reference in a new issue