diff options
-rw-r--r-- | config/application.rb | 5 | ||||
-rw-r--r-- | spec/controllers/general_controller_spec.rb | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/config/application.rb b/config/application.rb index 92fd30685..8bfec7f4b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -71,5 +71,10 @@ module Alaveteli # Insert a bit of middleware code to prevent uneeded cookie setting. require "#{Rails.root}/lib/whatdotheyknow/strip_empty_sessions" config.middleware.insert_before ActionDispatch::Session::CookieStore, WhatDoTheyKnow::StripEmptySessions, :key => '_wdtk_cookie_session', :path => "/", :httponly => true + + # Ignore ACCEPT headers as a specification of format, only pay attention to + # formats specified in URLs + config.action_dispatch.ignore_accept_header = true + end end diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb index bce12248b..083197d24 100644 --- a/spec/controllers/general_controller_spec.rb +++ b/spec/controllers/general_controller_spec.rb @@ -347,4 +347,10 @@ describe GeneralController, 'when using xapian search' do response.body.should include('Track this search') end + it 'should ignore an odd ACCEPTS header' do + request.env['HTTP_ACCEPT'] = '*/*;q=0.01' + get :search, :combined => '"fancy dog"' + response.should be_success + end + end |