Delivering error message via header in pecan.abort

This patch correlates with [1] in client side, when authentication
failed, the error message should be delivered to client side.

[1]: https://review.openstack.org/232395

Change-Id: I6a6ced466c05849fd9ff3dcd8377a57c9e9b595f
Closes-Bug: #1502840
This commit is contained in:
Lingxian Kong 2015-10-08 15:48:12 +08:00
parent 49cca5ef44
commit 6d07c3e6b6

View File

@ -207,7 +207,11 @@ class AuthHook(hooks.PecanHook):
else: else:
msg = 'Authentication required' msg = 'Authentication required'
pecan.abort(status_code=401, detail=msg) pecan.abort(
status_code=401,
detail=msg,
headers={'Server-Error-Message': msg}
)
class ContextHook(hooks.PecanHook): class ContextHook(hooks.PecanHook):