Bug 17387: add pagination headers and support comma-delimited Accept headers

Signed-off-by: Michaela <michaela.sieber@kit.edu>
Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jacob O'Mara 2025-10-30 11:02:35 +00:00 committed by Lucas Gass
parent d2ad055c30
commit 321e9647ea
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 6 additions and 5 deletions

View File

@ -122,30 +122,31 @@ sub list {
return try {
if ( $c->req->headers->accept =~ m/application\/json(;.*)?$/ ) {
if ( $c->req->headers->accept =~ m/application\/json([;,].*)?$/ ) {
$c->add_pagination_headers();
return $c->render(
status => 200,
json => $c->objects->to_api($biblios),
);
} elsif ( $c->req->headers->accept =~ m/application\/marcxml\+xml(;.*)?$/ ) {
} elsif ( $c->req->headers->accept =~ m/application\/marcxml\+xml([;,].*)?$/ ) {
$c->res->headers->add( 'Content-Type', 'application/marcxml+xml' );
return $c->render(
status => 200,
text => $biblios->print_collection('marcxml')
);
} elsif ( $c->req->headers->accept =~ m/application\/marc-in-json(;.*)?$/ ) {
} elsif ( $c->req->headers->accept =~ m/application\/marc-in-json([;,].*)?$/ ) {
$c->res->headers->add( 'Content-Type', 'application/marc-in-json' );
return $c->render(
status => 200,
data => $biblios->print_collection('mij')
);
} elsif ( $c->req->headers->accept =~ m/application\/marc(;.*)?$/ ) {
} elsif ( $c->req->headers->accept =~ m/application\/marc([;,].*)?$/ ) {
$c->res->headers->add( 'Content-Type', 'application/marc' );
return $c->render(
status => 200,
text => $biblios->print_collection('marc')
);
} elsif ( $c->req->headers->accept =~ m/text\/plain(;.*)?$/ ) {
} elsif ( $c->req->headers->accept =~ m/text\/plain([;,].*)?$/ ) {
return $c->render(
status => 200,
text => $biblios->print_collection('txt')