Commit f402762d authored by Douwe Maan's avatar Douwe Maan

Merge branch 'fj-41598-fixing-request-mime-type' into 'master'

Fixing request json mime type

Closes #41598

See merge request gitlab-org/gitlab-ce!16427
parents b3d85110 4f6e0379
---
title: Fixing rack request mime type when using rack attack
merge_request: 16427
author:
type: fixed
...@@ -96,9 +96,7 @@ module Gitlab ...@@ -96,9 +96,7 @@ module Gitlab
end end
def ensure_action_dispatch_request(request) def ensure_action_dispatch_request(request)
return request if request.is_a?(ActionDispatch::Request) ActionDispatch::Request.new(request.env.dup)
ActionDispatch::Request.new(request.env)
end end
def current_request def current_request
......
...@@ -76,6 +76,16 @@ describe Gitlab::Auth::UserAuthFinders do ...@@ -76,6 +76,16 @@ describe Gitlab::Auth::UserAuthFinders do
expect(find_user_from_rss_token).to be_nil expect(find_user_from_rss_token).to be_nil
end end
end end
context 'when the request format is empty' do
it 'the method call does not modify the original value' do
env['action_dispatch.request.formats'] = nil
find_user_from_rss_token
expect(env['action_dispatch.request.formats']).to be_nil
end
end
end end
describe '#find_user_from_access_token' do describe '#find_user_from_access_token' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment