This commit is contained in:
Benjamin Toueg 2013-05-23 14:51:31 -07:00
commit ee46179573
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 oauth, oauth_provider, oauth_provider_store
from rest_framework.compat import oauth2_provider from rest_framework.compat import oauth2_provider
from rest_framework.authtoken.models import Token from rest_framework.authtoken.models import Token
from rest_framework.settings import api_settings
def get_authorization_header(request): 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. 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(''): if type(auth) == type(''):
# Work around django test client oddness # Work around django test client oddness
auth = auth.encode(HTTP_HEADER_ENCODING) auth = auth.encode(HTTP_HEADER_ENCODING)

View File

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