@@ -347,28 +347,11 @@ sub _retrieve_json_params {
347347 my $params = {};
348348 %{$params } = %{ Bugzilla-> input_params };
349349
350- # First add any parameters we were able to pull out of the path
351- # based on the resource regexp and combine with the normal URL
352- # parameters.
353- if (my $rest_params = $self -> bz_rest_params) {
354- foreach my $param (keys %$rest_params ) {
355- if (!exists $params -> {$param }) {
356- $params -> {$param } = $rest_params -> {$param };
357- next ;
358- }
359- my @values = ref $rest_params -> {$param }
360- ? @{ $rest_params -> {$param } }
361- : ($rest_params -> {$param });
362- if (ref $params -> {$param }) {
363- push (@{ $params -> {$param } }, @values );
364- }
365- else {
366- $params -> {$param } = [ $params -> {$param }, @values ];
367- }
368- }
369- }
350+ # First add any params we were able to pull out of the path
351+ # based on the resource regexp
352+ %{$params } = (%{$params }, %{$self -> bz_rest_params}) if $self -> bz_rest_params;
370353
371- # Merge any additional query key/values from the request body if non- GET.
354+ # Merge any additional query key/values with $obj->{params} if not a GET request
372355 # We do this manually cause CGI.pm doesn't understand JSON strings.
373356 if ($self -> request-> method ne ' GET' ) {
374357 my $extra_params = {};
@@ -379,6 +362,14 @@ sub _retrieve_json_params {
379362 ThrowUserError(' json_rpc_invalid_params' , { err_msg => $@ });
380363 }
381364 }
365+
366+ # Allow parameters in the query string if request was not GET.
367+ # Note: query string parameters will override any matching params
368+ # also specified in the request body.
369+ foreach my $param ($self -> cgi-> url_param()) {
370+ $extra_params -> {$param } = $self -> cgi-> url_param($param );
371+ }
372+
382373 %{$params } = (%{$params }, %{$extra_params }) if %{$extra_params };
383374 }
384375
0 commit comments