summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Danjou <julien@danjou.info>2016-12-28 16:52:01 +0100
committerJulien Danjou <julien@danjou.info>2016-12-28 16:52:01 +0100
commit20fb1dbe5a884ecdbf6ee5ea26b2660f7a7e4b1e (patch)
tree2a3fcd1973bbe6012ef50223a2788abaec23d501
parent3e6c3ff6bde8c921704fa9506fb2ba89762f65cd (diff)
downloadkeystonemiddleware-20fb1dbe5a884ecdbf6ee5ea26b2660f7a7e4b1e.tar.gz
auth_token: set correct charset when replying with 401
The Content-Type header does not contain the charset used for the message. It's now required by webob: File "/home/jenkins/workspace/gate-gnocchi-tox-db-py35-mysql-ubuntu-xenial/.tox/py35-mysql/lib/python3.5/site-packages/keystonemiddleware/auth_token/__init__.py", line 331, in __call__ response = self.process_request(req) File "/home/jenkins/workspace/gate-gnocchi-tox-db-py35-mysql-ubuntu-xenial/.tox/py35-mysql/lib/python3.5/site-packages/keystonemiddleware/auth_token/__init__.py", line 650, in process_request content_type='application/json') File "/home/jenkins/workspace/gate-gnocchi-tox-db-py35-mysql-ubuntu-xenial/.tox/py35-mysql/lib/python3.5/site-packages/webob/exc.py", line 268, in __init__' **kw) File "/home/jenkins/workspace/gate-gnocchi-tox-db-py35-mysql-ubuntu-xenial/.tox/py35-mysql/lib/python3.5/site-packages/webob/response.py", line 310, in __init__' "You cannot set the body to a text value without a " TypeError: You cannot set the body to a text value without a charset Change-Id: Ia6c667c9afcba0811f51f3e50f34de05310d1433
-rw-r--r--keystonemiddleware/auth_token/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/keystonemiddleware/auth_token/__init__.py b/keystonemiddleware/auth_token/__init__.py
index cfdc01c..a136a65 100644
--- a/keystonemiddleware/auth_token/__init__.py
+++ b/keystonemiddleware/auth_token/__init__.py
@@ -647,7 +647,7 @@ class AuthProtocol(BaseAuthProtocol):
raise webob.exc.HTTPUnauthorized(
body=jsonutils.dumps(body),
headers=self._reject_auth_headers,
- content_type='application/json')
+ content_type='application/json; charset=UTF-8')
if request.user_token_valid:
request.set_user_headers(request.token_auth.user)