summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService/Server
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-02-27 08:53:50 +0100
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-02-27 08:53:50 +0100
commit4ac48f08be400b915e88ba25249a04a8a2747fd7 (patch)
tree69e3720a3cc17701eb4acaaa3d89d2d2aca1d885 /Bugzilla/WebService/Server
parent65255e8cff64819ee45cfcbcebb049abf4f1f756 (diff)
downloadbugzilla-4ac48f08be400b915e88ba25249a04a8a2747fd7.tar.gz
bugzilla-4ac48f08be400b915e88ba25249a04a8a2747fd7.tar.xz
Bug 547852: Make the JSON-RPC interface return the correct error format to
JSON-RPC 1.0 clients. r=dkl, a=mkanat
Diffstat (limited to 'Bugzilla/WebService/Server')
-rw-r--r--Bugzilla/WebService/Server/JSONRPC.pm13
1 files changed, 10 insertions, 3 deletions
diff --git a/Bugzilla/WebService/Server/JSONRPC.pm b/Bugzilla/WebService/Server/JSONRPC.pm
index 35eda1af1..f929b28ac 100644
--- a/Bugzilla/WebService/Server/JSONRPC.pm
+++ b/Bugzilla/WebService/Server/JSONRPC.pm
@@ -35,8 +35,6 @@ sub new {
Bugzilla->_json_server($self);
$self->dispatch(WS_DISPATCH);
$self->return_die_message(1);
- # Default to JSON-RPC 1.0
- $self->version(0);
return $self;
}
@@ -95,6 +93,15 @@ sub datetime_format {
return $iso_datetime;
}
+
+# Store the ID of the current call, because Bugzilla::Error will need it.
+sub _handle {
+ my $self = shift;
+ my ($obj) = @_;
+ $self->{_bz_request_id} = $obj->{id};
+ return $self->SUPER::_handle(@_);
+}
+
# Make all error messages returned by JSON::RPC go into the 100000
# range, and bring down all our errors into the normal range.
sub _error {
@@ -116,7 +123,7 @@ sub _error {
# We want to always send the JSON-RPC 1.1 error format, although
# If we're not in JSON-RPC 1.1, we don't need the silly "name" parameter.
- if (!$self->version) {
+ if (!$self->version or $self->version ne '1.1') {
my $object = $self->json->decode($json);
my $message = $object->{error};
# Just assure that future versions of JSON::RPC don't change the