diff options
author | Paul Sadauskas <psadauskas@gmail.com> | 2010-02-08 11:08:31 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-04-01 17:42:46 -0700 |
commit | dc5300adb6d46252c26e239ac67e3ca6e5e2d77b (patch) | |
tree | d5e538f54a0e6ad521c5608a58a0d7431548aad0 | |
parent | ab281f511ccb3893ea077fe8a7bb78cdd2db0885 (diff) | |
download | rails-dc5300adb6d46252c26e239ac67e3ca6e5e2d77b.tar.gz rails-dc5300adb6d46252c26e239ac67e3ca6e5e2d77b.tar.bz2 rails-dc5300adb6d46252c26e239ac67e3ca6e5e2d77b.zip |
Slightly less annoying check for acceptable mime_types. This allows Accept: application/json, application/jsonp (and the like), but still blacklists browsers. Essentially, we use normal content negotiation unless you include */* in your list, in which case we assume you're a browser and send HTML [#3541 state:resolved]
-rw-r--r-- | actionpack/lib/action_dispatch/http/mime_negotiation.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/mime_negotiation.rb b/actionpack/lib/action_dispatch/http/mime_negotiation.rb index be89924015..4082770b85 100644 --- a/actionpack/lib/action_dispatch/http/mime_negotiation.rb +++ b/actionpack/lib/action_dispatch/http/mime_negotiation.rb @@ -48,7 +48,7 @@ module ActionDispatch @env["action_dispatch.request.formats"] ||= if parameters[:format] Array(Mime[parameters[:format]]) - elsif xhr? || (accept && !accept.include?(?,)) + elsif xhr? || (accept && accept !~ /,\s*\*\/\*/) accepts else [Mime::HTML] @@ -87,4 +87,4 @@ module ActionDispatch end end end -end
\ No newline at end of file +end |