Skip to content

Commit

Permalink
Slightly less annoying check for acceptable mime_types. This allows A…
Browse files Browse the repository at this point in the history
…ccept: 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]
  • Loading branch information
paul authored and wycats committed Apr 2, 2010
1 parent ab281f5 commit dc5300a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/action_dispatch/http/mime_negotiation.rb
Expand Up @@ -48,7 +48,7 @@ def formats
@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]
Expand Down Expand Up @@ -87,4 +87,4 @@ def negotiate_mime(order)
end
end
end
end
end

2 comments on commit dc5300a

@dmathieu
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't there be some tests with it ?

@jeremy
Copy link
Member

@jeremy jeremy commented on dc5300a Apr 2, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Reopened the ticket.

Please sign in to comment.