aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-04-10 14:30:09 +0100
committerDavid Lawrence <dkl@mozilla.com>2015-04-10 14:30:09 +0100
commitee238ab3729d8cfe9d0a5fa66fbf0433679cef3c (patch)
tree8997a0e0a17f075394b8631af2ee4210ed5edb79
parent665c59e340ea674c96a0c61a35f47c57b20cc0ed (diff)
downloadbugs-ee238ab3729d8cfe9d0a5fa66fbf0433679cef3c.tar
bugs-ee238ab3729d8cfe9d0a5fa66fbf0433679cef3c.tar.gz
bugs-ee238ab3729d8cfe9d0a5fa66fbf0433679cef3c.tar.bz2
bugs-ee238ab3729d8cfe9d0a5fa66fbf0433679cef3c.tar.xz
bugs-ee238ab3729d8cfe9d0a5fa66fbf0433679cef3c.zip
Bug 1152319: calling /rest/logout results in an internal error and a malformed response to the caller
r=glob,a=glob
-rw-r--r--Bugzilla/WebService/Server/REST.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/Bugzilla/WebService/Server/REST.pm b/Bugzilla/WebService/Server/REST.pm
index b3d35595f..cefebd65d 100644
--- a/Bugzilla/WebService/Server/REST.pm
+++ b/Bugzilla/WebService/Server/REST.pm
@@ -130,6 +130,16 @@ sub response {
$result = $json_data->{result};
}
+ # The result needs to be a valid JSON data structure
+ # and not a undefined or scalar value.
+ if (!ref $result
+ || blessed($result)
+ || ref $result ne 'HASH'
+ || ref $result ne 'ARRAY')
+ {
+ $result = { result => $result };
+ }
+
Bugzilla::Hook::process('webservice_rest_response',
{ rpc => $self, result => \$result, response => $response });