Bugzilla – Attachment 139821 Details for
Bug 31468
Koha::Logger should prefix interface with 'plack'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31468: Changes to C4::Context::is_psgi_or_plack
Bug-31468-Changes-to-C4Contextispsgiorplack.patch (text/plain), 2.25 KB, created by
Marcel de Rooy
on 2022-08-26 09:34:03 UTC
(
hide
)
Description:
Bug 31468: Changes to C4::Context::is_psgi_or_plack
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-08-26 09:34:03 UTC
Size:
2.25 KB
patch
obsolete
>From 1221c41bd373fc95346f7eba4fc663370d477cae Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 26 Aug 2022 09:23:18 +0000 >Subject: [PATCH] Bug 31468: Changes to C4::Context::is_psgi_or_plack >Content-Type: text/plain; charset=utf-8 > >When running API, we need to look for $ENV{PLACK_ENV}, but the >underscore is not included in the Context sub. > >Test plan: >Run t/Context.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Context.pm | 2 +- > t/Context.t | 23 ++++++++++++++++++++++- > 2 files changed, 23 insertions(+), 2 deletions(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 654414de3c..d4415a5488 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -1009,7 +1009,7 @@ this is a PSGI app or a CGI app, and implementing code as appropriate. > > sub is_psgi_or_plack { > my $is_psgi_or_plack = 0; >- if ( any { /(^psgi\.|^plack\.)/i } keys %ENV ) { >+ if ( any { /^(psgi|plack)[._]/i } keys %ENV ) { > $is_psgi_or_plack = 1; > } > return $is_psgi_or_plack; >diff --git a/t/Context.t b/t/Context.t >index f3e15a56c1..93095d7e8b 100755 >--- a/t/Context.t >+++ b/t/Context.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > > use DBI; >-use Test::More tests => 32; >+use Test::More tests => 33; > use Test::MockModule; > use Test::Warn; > use YAML::XS; >@@ -145,3 +145,24 @@ is( C4::Context->interface( 'CRON' ), 'cron', 'interface cron uc' ); > $ENV{HTTPS} = 'ON'; > is( C4::Context->https_enabled, 1, "ON HTTPS env returns 1"); > } >+ >+subtest 'is_psgi_or_plack' => sub { >+ plan tests => 7; >+ >+ local %ENV = ( no_plack => 1 ); >+ is( C4::Context->is_psgi_or_plack, 0, 'no_plack' ); >+ $ENV{plackishere} = 1; >+ is( C4::Context->is_psgi_or_plack, 0, 'plackishere is wrong' ); >+ $ENV{'plack.ishere'} = 1; >+ is( C4::Context->is_psgi_or_plack, 1, 'plack.ishere' ); >+ delete $ENV{'plack.ishere'}; >+ is( C4::Context->is_psgi_or_plack, 0, 'plack.ishere was here' ); >+ $ENV{'plack_ishere'} = 1; >+ is( C4::Context->is_psgi_or_plack, 1, 'plack_ishere' ); >+ delete $ENV{'plack_ishere'}; >+ $ENV{'psgi_whatever'} = 1; >+ is( C4::Context->is_psgi_or_plack, 1, 'psgi_whatever' ); >+ delete $ENV{'psgi_whatever'}; >+ $ENV{'psgi.whatever'} = 1; >+ is( C4::Context->is_psgi_or_plack, 1, 'psgi.whatever' ); >+}; >-- >2.20.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 31468
:
139821
|
139822
|
140693
|
140697