From 96503e274e30d70d4124626559462078109e83af Mon Sep 17 00:00:00 2001 From: Shawn Niederriter Date: Wed, 1 Mar 2017 08:43:39 +0000 Subject: [PATCH] Fixed token parse error --- sanic/request.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sanic/request.py b/sanic/request.py index bca0cf27..4d2a0bbb 100644 --- a/sanic/request.py +++ b/sanic/request.py @@ -39,7 +39,7 @@ class Request(dict): 'app', 'url', 'headers', 'version', 'method', '_cookies', 'transport', 'query_string', 'body', 'parsed_json', 'parsed_args', 'parsed_form', 'parsed_files', - '_ip', + '_ip','_token' ) def __init__(self, url_bytes, headers, version, method, transport): @@ -79,10 +79,9 @@ 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 + if not hasattr(self, '_token'): + self._token = self.headers.get('Authorization') + return self._token @property def form(self):