Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix ActionDispatch::Request#formats when HTTP_ACCEPT header is empty …

…string
  • Loading branch information...
commit bebb02fd1c5ea0e8da9fb61eefcbb6ec8b9ab11f 1 parent ee314a5
soylent soylent authored
2  actionpack/lib/action_dispatch/http/mime_negotiation.rb
View
@@ -122,7 +122,7 @@ def negotiate_mime(order)
def valid_accept_header
(xhr? && (accept || content_mime_type)) ||
- (accept && accept !~ BROWSER_LIKE_ACCEPTS)
+ (accept.present? && accept !~ BROWSER_LIKE_ACCEPTS)
end
def use_accept_header
4 actionpack/test/dispatch/request_test.rb
View
@@ -587,6 +587,10 @@ def url_for(options = {})
request.expects(:parameters).at_least_once.returns({})
assert_equal [Mime::HTML], request.formats
+ request = stub_request 'HTTP_ACCEPT' => ''
+ request.expects(:parameters).at_least_once.returns({})
+ assert_equal [Mime::HTML], request.formats
+
request = stub_request 'CONTENT_TYPE' => 'application/xml; charset=UTF-8',
'HTTP_X_REQUESTED_WITH' => "XMLHttpRequest"
request.expects(:parameters).at_least_once.returns({})
Please sign in to comment.
Something went wrong with that request. Please try again.