diff options
author | David Lawrence <dkl@mozilla.com> | 2014-11-11 04:17:10 +0100 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2014-11-11 04:17:10 +0100 |
commit | 2d223dcbe7bf5c045a11ea489a0964129518731e (patch) | |
tree | 28c45230ef0b80f5d4f8d5f4a0dc414a89a72f8e /Bugzilla/WebService | |
parent | c2533c1f2e7c5c4376eb0dae17c3380b04067678 (diff) | |
download | bugzilla-2d223dcbe7bf5c045a11ea489a0964129518731e.tar.gz bugzilla-2d223dcbe7bf5c045a11ea489a0964129518731e.tar.xz |
Bug 1089805: BzAPI compatibility layer returns HTTP 200 when a bug update failed
Diffstat (limited to 'Bugzilla/WebService')
-rw-r--r-- | Bugzilla/WebService/Constants.pm | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/Bugzilla/WebService/Constants.pm b/Bugzilla/WebService/Constants.pm index 72863cb0f..83cae251b 100644 --- a/Bugzilla/WebService/Constants.pm +++ b/Bugzilla/WebService/Constants.pm @@ -225,26 +225,33 @@ use constant STATUS_GONE => 410; # the related webvservice call. We choose the appropriate # http status code based on the error code or use the # default STATUS_BAD_REQUEST. -use constant REST_STATUS_CODE_MAP => { - 51 => STATUS_NOT_FOUND, - 101 => STATUS_NOT_FOUND, - 102 => STATUS_NOT_AUTHORIZED, - 106 => STATUS_NOT_AUTHORIZED, - 109 => STATUS_NOT_AUTHORIZED, - 110 => STATUS_NOT_AUTHORIZED, - 113 => STATUS_NOT_AUTHORIZED, - 115 => STATUS_NOT_AUTHORIZED, - 120 => STATUS_NOT_AUTHORIZED, - 300 => STATUS_NOT_AUTHORIZED, - 301 => STATUS_NOT_AUTHORIZED, - 302 => STATUS_NOT_AUTHORIZED, - 303 => STATUS_NOT_AUTHORIZED, - 304 => STATUS_NOT_AUTHORIZED, - 410 => STATUS_NOT_AUTHORIZED, - 504 => STATUS_NOT_AUTHORIZED, - 505 => STATUS_NOT_AUTHORIZED, - 32614 => STATUS_NOT_FOUND, - _default => STATUS_BAD_REQUEST +sub REST_STATUS_CODE_MAP { + my $status_code_map = { + 51 => STATUS_NOT_FOUND, + 101 => STATUS_NOT_FOUND, + 102 => STATUS_NOT_AUTHORIZED, + 106 => STATUS_NOT_AUTHORIZED, + 109 => STATUS_NOT_AUTHORIZED, + 110 => STATUS_NOT_AUTHORIZED, + 113 => STATUS_NOT_AUTHORIZED, + 115 => STATUS_NOT_AUTHORIZED, + 120 => STATUS_NOT_AUTHORIZED, + 300 => STATUS_NOT_AUTHORIZED, + 301 => STATUS_NOT_AUTHORIZED, + 302 => STATUS_NOT_AUTHORIZED, + 303 => STATUS_NOT_AUTHORIZED, + 304 => STATUS_NOT_AUTHORIZED, + 410 => STATUS_NOT_AUTHORIZED, + 504 => STATUS_NOT_AUTHORIZED, + 505 => STATUS_NOT_AUTHORIZED, + 32614 => STATUS_NOT_FOUND, + _default => STATUS_BAD_REQUEST + }; + + Bugzilla::Hook::process('webservice_status_code_map', + { status_code_map => $status_code_map }); + + return $status_code_map; }; # These are the fallback defaults for errors not in ERROR_CODE. |