|
Lines 216-243
controller, and thus shouldn't be called twice in it.
Link Here
|
| 216 |
my $query_params; |
216 |
my $query_params; |
| 217 |
|
217 |
|
| 218 |
my $q_param = $reserved_params->{q}; |
218 |
my $q_param = $reserved_params->{q}; |
|
|
219 |
my $q_body = $c->req->json; |
| 219 |
|
220 |
|
| 220 |
if ( $q_param |
221 |
if ( $q_param || $q_body ) { |
| 221 |
|| defined $reserved_params->{query} ) |
|
|
| 222 |
{ |
| 223 |
|
222 |
|
| 224 |
my @query_params_array; |
223 |
my @query_params_array; |
| 225 |
|
224 |
|
| 226 |
my $json = JSON->new; |
225 |
my $json = JSON->new; |
| 227 |
|
226 |
|
| 228 |
# query in request body, JSON::Validator already decoded it |
|
|
| 229 |
if ( $reserved_params->{query} ) { |
| 230 |
my $query = $json->encode( $reserved_params->{query} ); |
| 231 |
foreach my $qf ( @{$query_fixers} ) { |
| 232 |
$query = $qf->($query); |
| 233 |
} |
| 234 |
push @query_params_array, $json->decode($query); |
| 235 |
} |
| 236 |
|
| 237 |
# The q parameter can be an array if multiple passed |
227 |
# The q parameter can be an array if multiple passed |
| 238 |
$q_param = [$q_param] |
228 |
$q_param = [$q_param] |
| 239 |
unless ref($q_param) eq 'ARRAY'; |
229 |
unless ref($q_param) eq 'ARRAY'; |
| 240 |
|
230 |
|
|
|
231 |
# Encode the already decoded request body and add it for processing |
| 232 |
push @{$q_param}, $json->encode($q_body) |
| 233 |
if $q_body; |
| 234 |
|
| 241 |
foreach my $q ( @{$q_param} ) { |
235 |
foreach my $q ( @{$q_param} ) { |
| 242 |
if ($q) { # skip if exists but is empty |
236 |
if ($q) { # skip if exists but is empty |
| 243 |
foreach my $qf ( @{$query_fixers} ) { |
237 |
foreach my $qf ( @{$query_fixers} ) { |