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

(-)a/Koha/REST/Plugin/Query.pm (-9 / +2 lines)
Lines 277-292 Merges parameters from $q_params into $filtered_params. Link Here
277
277
278
            my ( $c ) = @_;
278
            my ( $c ) = @_;
279
279
280
            my $override_header = $c->req->headers->header('x-koha-override');
280
            my $override_header = $c->req->headers->header('x-koha-override') || q{};
281
281
282
            my $overrides = {};
282
            my $overrides = { map { $_ => 1 } split /\s*,\s*/, $override_header };
283
284
            if ( $override_header ) {
285
                my @overrides = ();
286
                foreach my $override ( split /\s*,\s*/, $override_header ) {
287
                    $overrides->{$override} = 1;
288
                }
289
            }
290
283
291
            $c->stash( 'koha.overrides' => $overrides );
284
            $c->stash( 'koha.overrides' => $overrides );
292
285
(-)a/t/Koha/REST/Plugin/Query.t (-2 / +5 lines)
Lines 502-508 subtest 'stash_embed() tests' => sub { Link Here
502
502
503
subtest 'stash_overrides() tests' => sub {
503
subtest 'stash_overrides() tests' => sub {
504
504
505
    plan tests => 4;
505
    plan tests => 6;
506
506
507
    my $t = Test::Mojo->new;
507
    my $t = Test::Mojo->new;
508
508
Lines 511-514 subtest 'stash_overrides() tests' => sub { Link Here
511
511
512
    $t->get_ok( '/stash_overrides' => { 'x-koha-override' => '' } )
512
    $t->get_ok( '/stash_overrides' => { 'x-koha-override' => '' } )
513
      ->json_is( {} ); # empty string is skipped
513
      ->json_is( {} ); # empty string is skipped
514
515
    $t->get_ok( '/stash_overrides' => { } )
516
      ->json_is( {} ); # x-koha-ovverride not passed is skipped
517
514
};
518
};
515
- 

Return to bug 27760