Add AUTHORIZATION_HEADER setting

This commit is contained in:
Benjamin 2013-05-23 23:32:58 +02:00
parent 287ff43cdd
commit eae844d515
2 changed files with 3 additions and 1 deletions

View File

@ -12,6 +12,7 @@ from rest_framework.compat import CsrfViewMiddleware
from rest_framework.compat import oauth, oauth_provider, oauth_provider_store
from rest_framework.compat import oauth2_provider
from rest_framework.authtoken.models import Token
from rest_framework.settings import api_settings
def get_authorization_header(request):
@ -20,7 +21,7 @@ def get_authorization_header(request):
Hide some test client ickyness where the header can be unicode.
"""
auth = request.META.get('HTTP_AUTHORIZATION', b'')
auth = request.META.get(api_settings.AUTHORIZATION_HEADER, b'')
if type(auth) == type(''):
# Work around django test client oddness
auth = auth.encode(HTTP_HEADER_ENCODING)

View File

@ -70,6 +70,7 @@ DEFAULTS = {
# Authentication
'UNAUTHENTICATED_USER': 'django.contrib.auth.models.AnonymousUser',
'UNAUTHENTICATED_TOKEN': None,
'AUTHORIZATION_HEADER': 'HTTP_AUTHORIZATION',
# Browser enhancements
'FORM_METHOD_OVERRIDE': '_method',