From f18e0b663d538552adaa26110d17ccd651e9b5ff Mon Sep 17 00:00:00 2001 From: Shawn Niederriter Date: Mon, 17 Apr 2017 14:38:24 +0000 Subject: [PATCH] Fixing token parser error --- sanic/request.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sanic/request.py b/sanic/request.py index 4a15c22f..30327214 100644 --- a/sanic/request.py +++ b/sanic/request.py @@ -38,7 +38,7 @@ class Request(dict): __slots__ = ( 'app', 'headers', 'version', 'method', '_cookies', 'transport', 'body', 'parsed_json', 'parsed_args', 'parsed_form', 'parsed_files', - '_ip', '_parsed_url', + '_ip', '_parsed_url', '_token', ) def __init__(self, url_bytes, headers, version, method, transport): @@ -77,10 +77,8 @@ class Request(dict): :return: token related to request """ - auth_header = self.headers.get('Authorization') - if auth_header is not None: - return auth_header.split()[1] - return auth_header + self._token = getattr(self, '_token', self.headers.get('Authorization')) + return self._token @property def form(self):