From 5743bb2945d3fb8900129123bf1f36f67310d843 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Wed, 17 Apr 2019 10:47:06 +0000 Subject: [PATCH] Bug 15496: (QA follow-up) Change success status on api DELETE response code must be 204, not 200 according to our API coding guidelines Test plan: prove t/db_dependent/api/v1/biblios.t Signed-off-by: Josef Moravec Signed-off-by: Tomas Cohen Arazi Signed-off-by: Nick Clemens --- Koha/REST/V1/Biblios.pm | 2 +- api/v1/swagger/paths/biblios.json | 2 +- t/db_dependent/api/v1/biblios.t | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Koha/REST/V1/Biblios.pm b/Koha/REST/V1/Biblios.pm index d5e5564b0c..6e8da01f82 100644 --- a/Koha/REST/V1/Biblios.pm +++ b/Koha/REST/V1/Biblios.pm @@ -54,7 +54,7 @@ sub delete { ); } else { - return $c->render( status => 200, openapi => "" ); + return $c->render( status => 204, openapi => "" ); } } catch { diff --git a/api/v1/swagger/paths/biblios.json b/api/v1/swagger/paths/biblios.json index 73ace63c07..f91d41c663 100644 --- a/api/v1/swagger/paths/biblios.json +++ b/api/v1/swagger/paths/biblios.json @@ -11,7 +11,7 @@ "application/json" ], "responses": { - "200": { + "204": { "description": "Biblio deleted", "schema": { "type": "string" diff --git a/t/db_dependent/api/v1/biblios.t b/t/db_dependent/api/v1/biblios.t index 03ef7cd2ea..6a503b5188 100644 --- a/t/db_dependent/api/v1/biblios.t +++ b/t/db_dependent/api/v1/biblios.t @@ -62,7 +62,8 @@ subtest 'delete() tests' => sub { # Bibs with no items can be deleted $t->delete_ok("//$userid:$password@/api/v1/biblios/$biblio_id") - ->status_is(200)->content_is(q{""}); + ->status_is(204, 'SWAGGER3.2.4') + ->content_is('', 'SWAGGER3.3.4'); $t->delete_ok("//$userid:$password@/api/v1/biblios/$biblio_id") ->status_is(404); -- 2.39.5