diff options
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/WebService/Server/REST.pm | 10 |
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 }); |