View | Details | Raw Unified | Return to bug 40423
Collapse All | Expand All

(-)a/Koha/REST/Plugin/Objects.pm (-2 / +2 lines)
Lines 263-270 controller, and thus shouldn't be called twice in it. Link Here
263
            }
263
            }
264
264
265
            # request sequence id (i.e. 'draw' Datatables parameter)
265
            # request sequence id (i.e. 'draw' Datatables parameter)
266
            $c->res->headers->add( 'x-koha-request-id' => $reserved_params->{'x-koha-request-id'} )
266
            $c->res->headers->add( 'x-koha-request-id' => $c->stash('koha.request_id') )
267
                if $reserved_params->{'x-koha-request-id'};
267
                if $c->stash('koha.request_id');
268
268
269
            # If search_limited exists, use it
269
            # If search_limited exists, use it
270
            $result_set = $result_set->search_limited,
270
            $result_set = $result_set->search_limited,
(-)a/Koha/REST/Plugin/Query.pm (-4 / +28 lines)
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
(-)a/Koha/REST/V1/Auth.pm (-1 / +1 lines)
Lines 149-154 sub authenticate_api_request { Link Here
149
149
150
    $c->stash_embed( { spec => $spec } );
150
    $c->stash_embed( { spec => $spec } );
151
    $c->stash_overrides();
151
    $c->stash_overrides();
152
    $c->stash_request_id();
152
153
153
    my $cookie_auth = 0;
154
    my $cookie_auth = 0;
154
155
155
- 

Return to bug 40423