summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2014-11-04 15:28:15 +0100
committerByron Jones <glob@mozilla.com>2014-11-04 15:28:15 +0100
commit64fc523d6feb517dae87d76ea8568f43b89e1547 (patch)
tree9e3ce8db905e9139023eeab44441e8a080c2435f /Bugzilla/WebService
parent6ba07835d76ea2eb9318d0bc419a3376be936a29 (diff)
downloadbugzilla-64fc523d6feb517dae87d76ea8568f43b89e1547.tar.gz
bugzilla-64fc523d6feb517dae87d76ea8568f43b89e1547.tar.xz
Bug 1093600: Backout Bug 1088253 for breaking comment adding
Diffstat (limited to 'Bugzilla/WebService')
-rw-r--r--Bugzilla/WebService/Server/REST.pm33
1 files changed, 12 insertions, 21 deletions
diff --git a/Bugzilla/WebService/Server/REST.pm b/Bugzilla/WebService/Server/REST.pm
index cd4536b97..69f97ef08 100644
--- a/Bugzilla/WebService/Server/REST.pm
+++ b/Bugzilla/WebService/Server/REST.pm
@@ -347,28 +347,11 @@ sub _retrieve_json_params {
my $params = {};
%{$params} = %{ Bugzilla->input_params };
- # First add any parameters we were able to pull out of the path
- # based on the resource regexp and combine with the normal URL
- # parameters.
- if (my $rest_params = $self->bz_rest_params) {
- foreach my $param (keys %$rest_params) {
- if (!exists $params->{$param}) {
- $params->{$param} = $rest_params->{$param};
- next;
- }
- my @values = ref $rest_params->{$param}
- ? @{ $rest_params->{$param} }
- : ($rest_params->{$param});
- if (ref $params->{$param}) {
- push(@{ $params->{$param} }, @values);
- }
- else {
- $params->{$param} = [ $params->{$param}, @values ];
- }
- }
- }
+ # First add any params we were able to pull out of the path
+ # based on the resource regexp
+ %{$params} = (%{$params}, %{$self->bz_rest_params}) if $self->bz_rest_params;
- # Merge any additional query key/values from the request body if non-GET.
+ # Merge any additional query key/values with $obj->{params} if not a GET request
# We do this manually cause CGI.pm doesn't understand JSON strings.
if ($self->request->method ne 'GET') {
my $extra_params = {};
@@ -379,6 +362,14 @@ sub _retrieve_json_params {
ThrowUserError('json_rpc_invalid_params', { err_msg => $@ });
}
}
+
+ # Allow parameters in the query string if request was not GET.
+ # Note: query string parameters will override any matching params
+ # also specified in the request body.
+ foreach my $param ($self->cgi->url_param()) {
+ $extra_params->{$param} = $self->cgi->url_param($param);
+ }
+
%{$params} = (%{$params}, %{$extra_params}) if %{$extra_params};
}