From 6d07c3e6b637861ebab20affb4a3274d92a54a9b Mon Sep 17 00:00:00 2001 From: Lingxian Kong Date: Thu, 8 Oct 2015 15:48:12 +0800 Subject: [PATCH] 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 --- mistral/context.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mistral/context.py b/mistral/context.py index 455e0b34..c404fb9b 100644 --- a/mistral/context.py +++ b/mistral/context.py @@ -207,7 +207,11 @@ class AuthHook(hooks.PecanHook): else: 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):