From f2e2475ac6383cf73bc07a560f4e0e6968f5e512 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 21 Oct 2019 16:21:16 -0300 Subject: [PATCH] Bug 23860: Make the patrons endpoint add the Location header Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- Koha/REST/V1/Patrons.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm index 46ad80d01d..fb9e51f67a 100644 --- a/Koha/REST/V1/Patrons.pm +++ b/Koha/REST/V1/Patrons.pm @@ -127,7 +127,11 @@ sub add { my $patron = Koha::Patron->new( _to_model($body) )->store; - return $c->render( status => 201, openapi => $patron->to_api ); + $c->res->headers->location( $c->req->url->to_string . '/' . $patron->borrowernumber ); + return $c->render( + status => 201, + openapi => $patron->to_api + ); } catch { unless ( blessed $_ && $_->can('rethrow') ) { -- 2.20.1