From 1ac802fe3c79fc2838253e71e4f32e3f1710f8f1 Mon Sep 17 00:00:00 2001 From: ogeidix Date: Tue, 19 Jul 2011 22:05:16 +0200 Subject: Check Accept and Content-Type headers before evaluating them in xhr requests. Closes #2119 An xhr request must have an "Accept" or "Content-type" header in order to be considered a request with valid_accept_header. --- actionpack/lib/action_dispatch/http/mime_negotiation.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch/http') diff --git a/actionpack/lib/action_dispatch/http/mime_negotiation.rb b/actionpack/lib/action_dispatch/http/mime_negotiation.rb index 980c658ab7..5c48a60469 100644 --- a/actionpack/lib/action_dispatch/http/mime_negotiation.rb +++ b/actionpack/lib/action_dispatch/http/mime_negotiation.rb @@ -98,7 +98,8 @@ module ActionDispatch BROWSER_LIKE_ACCEPTS = /,\s*\*\/\*|\*\/\*\s*,/ def valid_accept_header - xhr? || (accept && accept !~ BROWSER_LIKE_ACCEPTS) + (xhr? && (accept || content_mime_type)) || + (accept && accept !~ BROWSER_LIKE_ACCEPTS) end def use_accept_header -- cgit v1.2.3