From a6d74986bd7b96aa41624ed407a46f7f63eadd55 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 10 Apr 2015 14:25:26 +0100 Subject: Bug 1152319: calling /rest/logout results in an internal error and a malformed response to the caller r=glob,a=glob --- Bugzilla/API/1_0/Server.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Bugzilla/API/1_0/Server.pm b/Bugzilla/API/1_0/Server.pm index ed147dc2a..6136440cf 100644 --- a/Bugzilla/API/1_0/Server.pm +++ b/Bugzilla/API/1_0/Server.pm @@ -89,6 +89,16 @@ sub handle { # Execute the handler my $result = $self->_handle; + # 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 }; + } + $self->response($result); } -- cgit v1.2.3-24-g4f1b