Fixed call strip call on missing Content-Type header
This commit is contained in:
parent
f7f39fde07
commit
34003df86e
|
@ -15,7 +15,7 @@ module Rack
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
status, headers, body = app.call(env)
|
status, headers, body = app.call(env)
|
||||||
if headers['Content-Type'].to_s.split(';', 2).first.strip == 'application/json'
|
if headers['Content-Type'].to_s.split(';', 2).first =~ /^\s*application\/json\s*$/
|
||||||
result = react(env) if referrer(env) != Request.new(env).host
|
result = react(env) if referrer(env) != Request.new(env).host
|
||||||
end
|
end
|
||||||
result or [status, headers, body]
|
result or [status, headers, body]
|
||||||
|
|
|
@ -20,4 +20,13 @@ describe Rack::Protection::JsonCsrf do
|
||||||
get('/', {}).should be_ok
|
get('/', {}).should be_ok
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'not json response' do
|
||||||
|
|
||||||
|
it "accepts get requests with 304 headers" do
|
||||||
|
mock_app { |e| [304, {}, []]}
|
||||||
|
get('/', {}).status.should == 304
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue