|
Lines 284-295
Unwraps and stashes the x-koha-embed headers for use later query construction
Link Here
|
| 284 |
|
284 |
|
| 285 |
# Stash the overrides |
285 |
# Stash the overrides |
| 286 |
$c->stash_overrides(); |
286 |
$c->stash_overrides(); |
| 287 |
#Use it |
287 |
# Use it |
| 288 |
my $overrides = $c->stash('koha.overrides'); |
288 |
my $overrides = $c->stash('koha.overrides'); |
| 289 |
if ( $overrides->{pickup_location} ) { ... } |
289 |
if ( $overrides->{pickup_location} ) { ... } |
| 290 |
|
290 |
|
| 291 |
This helper method parses 'x-koha-override' headers and stashes the passed overriders |
291 |
This helper method parses the 'x-koha-override' headers and stashes the passed overrides |
| 292 |
in the for of a I<hashref> for easy use in controller methods. |
292 |
in the form of a I<hashref> for easy use in controller methods. |
| 293 |
|
293 |
|
| 294 |
FIXME: With the currently used JSON::Validator version we use, it is not possible to |
294 |
FIXME: With the currently used JSON::Validator version we use, it is not possible to |
| 295 |
use the validated and coerced data (it doesn't validate array-type headers) so this |
295 |
use the validated and coerced data (it doesn't validate array-type headers) so this |
|
Lines 309-314
reference: https://metacpan.org/changes/distribution/JSON-Validator#L14
Link Here
|
| 309 |
|
309 |
|
| 310 |
$c->stash( 'koha.overrides' => $overrides ); |
310 |
$c->stash( 'koha.overrides' => $overrides ); |
| 311 |
|
311 |
|
|
|
312 |
return $c; |
| 313 |
} |
| 314 |
); |
| 315 |
|
| 316 |
=head3 stash_request_id |
| 317 |
|
| 318 |
# Stash the request ID |
| 319 |
$c->stash_request_id(); |
| 320 |
# Use it |
| 321 |
my $request_id = $c->stash('koha.request_id'); |
| 322 |
|
| 323 |
This helper method parses the 'x-koha-request-id' header and stashes the value. |
| 324 |
|
| 325 |
=cut |
| 326 |
|
| 327 |
$app->helper( |
| 328 |
'stash_request_id' => sub { |
| 329 |
|
| 330 |
my ($c) = @_; |
| 331 |
|
| 332 |
my $request_id = $c->req->headers->header('x-koha-request-id') || q{}; |
| 333 |
|
| 334 |
$c->stash( 'koha.request_id' => $request_id ); |
| 335 |
|
| 312 |
return $c; |
336 |
return $c; |
| 313 |
} |
337 |
} |
| 314 |
); |
338 |
); |
|
Lines 324-330
reference: https://metacpan.org/changes/distribution/JSON-Validator#L14
Link Here
|
| 324 |
|
348 |
|
| 325 |
sub _reserved_words { |
349 |
sub _reserved_words { |
| 326 |
|
350 |
|
| 327 |
my @reserved_words = qw( _match _order_by _order_by[] _page _per_page q query x-koha-request-id x-koha-embed); |
351 |
my @reserved_words = qw( _match _order_by _order_by[] _page _per_page q query); |
| 328 |
return \@reserved_words; |
352 |
return \@reserved_words; |
| 329 |
} |
353 |
} |
| 330 |
|
354 |
|