Bugzilla – Attachment 86120 Details for
Bug 13895
Add routes for checkouts retrieval and renewal
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13895: (follow-up) Fix POST response
Bug-13895-follow-up-Fix-POST-response.patch (text/plain), 3.10 KB, created by
Michal Denar
on 2019-03-05 20:37:40 UTC
(
hide
)
Description:
Bug 13895: (follow-up) Fix POST response
Filename:
MIME Type:
Creator:
Michal Denar
Created:
2019-03-05 20:37:40 UTC
Size:
3.10 KB
patch
obsolete
>From 9a596b56544204ee95015eb8a545d5740a865bac Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Mon, 25 Feb 2019 22:17:01 +0000 >Subject: [PATCH] Bug 13895: (follow-up) Fix POST response > >Test plan: >prove t/db_dependent/api/v1/chcekouts.t > >Signed-off-by: Michal Denar <black23@gmail.com> >--- > Koha/REST/V1/Checkout.pm | 3 ++- > api/v1/swagger/paths/checkouts.json | 2 +- > t/db_dependent/api/v1/checkouts.t | 13 ++++++++----- > 3 files changed, 11 insertions(+), 7 deletions(-) > >diff --git a/Koha/REST/V1/Checkout.pm b/Koha/REST/V1/Checkout.pm >index a454fc4514..3dba36c316 100644 >--- a/Koha/REST/V1/Checkout.pm >+++ b/Koha/REST/V1/Checkout.pm >@@ -118,8 +118,9 @@ sub renew { > AddRenewal($borrowernumber, $itemnumber, $checkout->branchcode); > $checkout = Koha::Checkouts->find($checkout_id); > >+ $c->res->headers->location( $c->req->url->to_string ); > return $c->render( >- status => 200, >+ status => 201, > openapi => _to_api( $checkout->TO_JSON ) > ); > } >diff --git a/api/v1/swagger/paths/checkouts.json b/api/v1/swagger/paths/checkouts.json >index 6324d75bce..134aee55ad 100644 >--- a/api/v1/swagger/paths/checkouts.json >+++ b/api/v1/swagger/paths/checkouts.json >@@ -73,7 +73,7 @@ > }], > "produces": ["application/json"], > "responses": { >- "200": { >+ "201": { > "description": "Updated borrower's checkout", > "schema": { "$ref": "../definitions.json#/checkout" } > }, >diff --git a/t/db_dependent/api/v1/checkouts.t b/t/db_dependent/api/v1/checkouts.t >index a6f340b31d..b3c31cc8c9 100644 >--- a/t/db_dependent/api/v1/checkouts.t >+++ b/t/db_dependent/api/v1/checkouts.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 51; >+use Test::More tests => 53; > use Test::MockModule; > use Test::Mojo; > use t::lib::Mocks; >@@ -137,8 +137,9 @@ $dbh->do(q{ > > my $expected_datedue = DateTime->now->add(days => 14)->set(hour => 23, minute => 59, second => 0); > $t->post_ok ( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" ) >- ->status_is(200) >- ->json_is('/due_date' => output_pref( { dateformat => "rfc3339", dt => $expected_datedue }) ); >+ ->status_is(201) >+ ->json_is('/due_date' => output_pref( { dateformat => "rfc3339", dt => $expected_datedue }) ) >+ ->header_is(Location => "/api/v1/checkouts/" . $issue1->issue_id . "/renewal"); > > $t->post_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->issue_id . "/renewal" ) > ->status_is(403) >@@ -147,8 +148,10 @@ $t->post_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->i > }); > > $t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id . "/renewal" ) >- ->status_is(200) >- ->json_is('/due_date' => output_pref({ dateformat => "rfc3339", dt => $expected_datedue}) ); >+ ->status_is(201) >+ ->json_is('/due_date' => output_pref({ dateformat => "rfc3339", dt => $expected_datedue}) ) >+ ->header_is(Location => "/api/v1/checkouts/" . $issue2->issue_id . "/renewal"); >+ > > $t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" ) > ->status_is(403) >-- >2.11.0
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 13895
:
37146
|
40104
|
40143
|
40588
|
41163
|
41548
|
45817
|
50021
|
51303
|
53816
|
53817
|
53878
|
53889
|
53890
|
53891
|
53901
|
53924
|
54196
|
54685
|
54951
|
56167
|
56506
|
58387
|
69123
|
84765
|
85458
|
85459
|
85460
|
85461
|
85462
|
85463
|
85464
|
85676
|
86120
|
86576
|
86579
|
86580
|
87105
|
87106
|
87107
|
87108
|
87109
|
87110
|
87111
|
87112
|
87113
|
87114
|
87115
|
87200