cehoffman/sinatra-respond_to — pull request #21 by francois (2013-05-09 22:51:52+00:00)
Title: Fallback to default_content if wildcard present in Accept header

If a browser makes a request like this:

Accept: text/csv,*.*

And the application is implemented like this:

set :default_content, :html

get "/" do
respond_to do |wants|
format.html { erb :home }
end
end

The request would return a 404, even though the caller specifically said
it was ready to accept any mime type.

I found this when building an API that does not return HTML: it returns
JSON or CSV, but browsers request HTML, XHTML and */*, in this order. By
catering to what the caller asked for, the API is more easily explorable
in a browser.