Rails 3 application is throwing an error when "Accept: none" HTTP headers are passed -
we've been seeing airbrake exceptions when browsers request our website specify accept: none http header (mostly mobile, looks like). after bunch of research, seems consumer-facing applications ignore accept http headers , send html, , fixed adding our mime_types.rb file
mime::type.register "none", :html but our emails started being sent in plain-text, believe because we're redefining how text/html supposed work. there better fix still send html when sends accept: none header?
edit: forgot say, got when ran rails c, , i'm wondering if i'm perhaps re-defining html.
$ rails c /1.9.3-p194/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/http/mime_type.rb:102: warning: initialized constant html
another fix add following before_filter applicationcontroller
def fix_accept_headers_for_none if request.formats.include?("none") request.format = :html end end
Comments
Post a Comment