Bugzilla – Attachment 176901 Details for
Bug 38929
POST endpoints not returning the Location header
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38929: Add xt test to enforce REST3.4.1 POST
Bug-38929-Add-xt-test-to-enforce-REST341-POST.patch (text/plain), 1.56 KB, created by
Jonathan Druart
on 2025-01-22 10:55:09 UTC
(
hide
)
Description:
Bug 38929: Add xt test to enforce REST3.4.1 POST
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-01-22 10:55:09 UTC
Size:
1.56 KB
patch
obsolete
>From 071fbf9be9a5b6a05fef981c6f9bb4f1226c79a2 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 22 Jan 2025 11:54:46 +0100 >Subject: [PATCH] Bug 38929: Add xt test to enforce REST3.4.1 POST > >--- > xt/api.t | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > >diff --git a/xt/api.t b/xt/api.t >index 6dd35af3b2d..47e00460db2 100755 >--- a/xt/api.t >+++ b/xt/api.t >@@ -14,7 +14,7 @@ > > use Modern::Perl; > >-use Test::More tests => 5; >+use Test::More tests => 6; > > use Test::Mojo; > use Data::Dumper; >@@ -22,6 +22,7 @@ use Data::Dumper; > use FindBin(); > use IPC::Cmd qw(can_run); > use List::MoreUtils qw(any); >+use File::Slurp qw(read_file); > > my $t = Test::Mojo->new('Koha::REST::V1'); > my $spec = $t->get_ok( '/api/v1/', 'Correctly fetched the spec' )->tx->res->json; >@@ -170,3 +171,19 @@ subtest '400 response tests' => sub { > print STDERR "$error\n"; > } > }; >+ >+subtest 'POST (201) have location header' => sub { >+ my @files = `git ls-files 'Koha/REST/V1/**/*.pm'`; >+ plan tests => scalar @files; >+ foreach my $file (@files) { >+ chomp $file; >+ my $content = read_file($file); >+ if ( $content !~ /status\s*=>\s*201/s ) { >+ pass("$file does not seem to have a POST endpoint"); >+ } elsif ( $content =~ /\$c->res->headers->location\(.*?\);\s*return\s+\$c->render\s*\(\s*status\s*=>\s*201,/s ) { >+ pass("$file contains the location header"); >+ } else { >+ fail("$file does not contain the location header"); >+ } >+ } >+}; >-- >2.34.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 38929
:
176832
|
176833
|
176834
|
176901
|
176906
|
177068
|
177069
|
177070
|
177071
|
177072
|
177106
|
177107
|
177108
|
177109
|
177110