From cbfcf8a57cdd9efa4139777c48dee27a2f1e34b2 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Mon, 26 Feb 2024 15:54:40 +0100 Subject: [PATCH] Set X-Opensuse-Errorcode for pundit errors As we do in ApplicationController#render_error --- src/api/app/controllers/concerns/rescue_authorization_handler.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api/app/controllers/concerns/rescue_authorization_handler.rb b/src/api/app/controllers/concerns/rescue_authorization_handler.rb index f2f45c1102f..0ae9af5a8a8 100644 --- a/src/api/app/controllers/concerns/rescue_authorization_handler.rb +++ b/src/api/app/controllers/concerns/rescue_authorization_handler.rb @@ -19,6 +19,7 @@ module RescueAuthorizationHandler format.any do @errorcode = authorization_errorcode(exception) @summary = authorization_message(exception) + response.headers['X-Opensuse-Errorcode'] = @errorcode render template: 'status', status: :forbidden, formats: [:xml] end end