Fixing request json mime type

This commit is contained in:
Francisco Javier López 2018-01-15 09:09:21 +00:00 committed by Douwe Maan
parent b3d85110d2
commit 4f6e0379b4
3 changed files with 16 additions and 3 deletions

View File

@ -0,0 +1,5 @@
---
title: Fixing rack request mime type when using rack attack
merge_request: 16427
author:
type: fixed

View File

@ -96,9 +96,7 @@ module Gitlab
end
def ensure_action_dispatch_request(request)
return request if request.is_a?(ActionDispatch::Request)
ActionDispatch::Request.new(request.env)
ActionDispatch::Request.new(request.env.dup)
end
def current_request

View File

@ -76,6 +76,16 @@ describe Gitlab::Auth::UserAuthFinders do
expect(find_user_from_rss_token).to be_nil
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
describe '#find_user_from_access_token' do