Bugzilla – Attachment 120114 Details for
Bug 27760
Add handling for x-koha-override
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27760: Improve readabiliity using map
Bug-27760-Improve-readabiliity-using-map.patch (text/plain), 1.87 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-04-23 15:22:31 UTC
(
hide
)
Description:
Bug 27760: Improve readabiliity using map
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-04-23 15:22:31 UTC
Size:
1.87 KB
patch
obsolete
>From b81cdf7c052edbd6e0ad3334370e57d1ef9a0c16 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 11 Mar 2021 11:15:26 +0100 >Subject: [PATCH] Bug 27760: Improve readabiliity using map > >--- > Koha/REST/Plugin/Query.pm | 11 ++--------- > t/Koha/REST/Plugin/Query.t | 6 +++++- > 2 files changed, 7 insertions(+), 10 deletions(-) > >diff --git a/Koha/REST/Plugin/Query.pm b/Koha/REST/Plugin/Query.pm >index d6ad18dfe11..d01d64d8fe0 100644 >--- a/Koha/REST/Plugin/Query.pm >+++ b/Koha/REST/Plugin/Query.pm >@@ -277,16 +277,9 @@ Merges parameters from $q_params into $filtered_params. > > my ( $c ) = @_; > >- my $override_header = $c->req->headers->header('x-koha-override'); >+ my $override_header = $c->req->headers->header('x-koha-override') || q{}; > >- my $overrides = {}; >- >- if ( $override_header ) { >- my @overrides = (); >- foreach my $override ( split /\s*,\s*/, $override_header ) { >- $overrides->{$override} = 1; >- } >- } >+ my $overrides = { map { $_ => 1 } split /\s*,\s*/, $override_header }; > > $c->stash( 'koha.overrides' => $overrides ); > >diff --git a/t/Koha/REST/Plugin/Query.t b/t/Koha/REST/Plugin/Query.t >index f5580d0cc24..c52914a7bfd 100755 >--- a/t/Koha/REST/Plugin/Query.t >+++ b/t/Koha/REST/Plugin/Query.t >@@ -502,7 +502,7 @@ subtest 'stash_embed() tests' => sub { > > subtest 'stash_overrides() tests' => sub { > >- plan tests => 4; >+ plan tests => 6; > > my $t = Test::Mojo->new; > >@@ -511,4 +511,8 @@ subtest 'stash_overrides() tests' => sub { > > $t->get_ok( '/stash_overrides' => { 'x-koha-override' => '' } ) > ->json_is( {} ); # empty string is skipped >+ >+ $t->get_ok( '/stash_overrides' => { } ) >+ ->json_is( {} ); # x-koha-ovverride not passed is skipped >+ > }; >-- >2.31.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27760
:
117308
|
117309
|
117326
|
117327
|
117342
|
117343
|
117344
|
118108
|
118110
|
120112
|
120113
| 120114 |
120115