Bugzilla – Attachment 176897 Details for
Bug 38932
Adding debits and credits should return the correct Location header
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38932: Make adding a credit return the Location header
Bug-38932-Make-adding-a-credit-return-the-Location.patch (text/plain), 1.38 KB, created by
David Nind
on 2025-01-22 10:26:56 UTC
(
hide
)
Description:
Bug 38932: Make adding a credit return the Location header
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-01-22 10:26:56 UTC
Size:
1.38 KB
patch
obsolete
>From 06744823ef0f694fc959e67cd61c14e0e6477888 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 20 Jan 2025 17:03:52 -0300 >Subject: [PATCH] Bug 38932: Make adding a credit return the Location header > >This patch makes the `POST /patrons/:patron_id/account/credits` endpoint >return a valid `Location` header. Tests are added. > >Bonus: the debits counterpart already returned the header, but pointed >to a non-existent endpoint (now added by bug 38931) and it gets tests >added. > >To test: >1. Apply the regression tests patch >2. Run: > $ ktd --shell > k$ prove t/db_dependent/api/v1/patrons_accounts.t >=> FAIL: The behavior is not implemented for credits. >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/REST/V1/Patrons/Account.pm | 2 ++ > 1 file changed, 2 insertions(+) > >diff --git a/Koha/REST/V1/Patrons/Account.pm b/Koha/REST/V1/Patrons/Account.pm >index 338a4e9e13..35a8a1b053 100644 >--- a/Koha/REST/V1/Patrons/Account.pm >+++ b/Koha/REST/V1/Patrons/Account.pm >@@ -168,6 +168,8 @@ sub add_credit { > > $credit->discard_changes; > >+ $c->res->headers->location( $c->req->url->to_string . '/' . $credit->id ); >+ > return $c->render( > status => 201, > openapi => $c->objects->to_api($credit), >-- >2.39.5
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 38932
:
176842
|
176843
|
176896
|
176897
|
177111
|
177112