Merge pull request #821 from Frzk/bearer-support
Inverted the order of prefixes in Request.token property.
This commit is contained in:
@@ -86,13 +86,13 @@ class Request(dict):
|
||||
|
||||
:return: token related to request
|
||||
"""
|
||||
prefixes = ('Token ', 'Bearer ')
|
||||
prefixes = ('Bearer', 'Token')
|
||||
auth_header = self.headers.get('Authorization')
|
||||
|
||||
if auth_header is not None:
|
||||
for prefix in prefixes:
|
||||
if prefix in auth_header:
|
||||
return auth_header.partition(prefix)[-1]
|
||||
return auth_header.partition(prefix)[-1].strip()
|
||||
|
||||
return auth_header
|
||||
|
||||
|
||||
Reference in New Issue
Block a user