Bug 36100: (QA follow-up) Move 400 to 409
Duplicate exceptions tend to generate a 409 in our REST API.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3e164d200a
)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
733546cf5f
commit
6e0e84bc9e
3 changed files with 6 additions and 2 deletions
|
@ -93,7 +93,7 @@ sub add {
|
|||
);
|
||||
} elsif ( blessed $_ and $_->isa('Koha::Exceptions::Object::DuplicateID') ) {
|
||||
return $c->render(
|
||||
status => 400,
|
||||
status => 409,
|
||||
openapi => {
|
||||
error => "Duplicate booking_id",
|
||||
}
|
||||
|
|
|
@ -102,6 +102,10 @@
|
|||
description: Access forbidden
|
||||
schema:
|
||||
$ref: ../swagger.yaml#/definitions/error
|
||||
409:
|
||||
description: Conflict
|
||||
schema:
|
||||
$ref: ../swagger.yaml#/definitions/error
|
||||
500:
|
||||
description: Internal error
|
||||
schema:
|
||||
|
|
|
@ -262,7 +262,7 @@ subtest 'add() tests' => sub {
|
|||
|
||||
# Authorized attempt to create with existing id
|
||||
$booking->{booking_id} = $booking_id;
|
||||
$t->post_ok( "//$userid:$password@/api/v1/bookings" => json => $booking )->status_is(400)
|
||||
$t->post_ok( "//$userid:$password@/api/v1/bookings" => json => $booking )->status_is(409)
|
||||
->json_is( "/error" => "Duplicate booking_id" );
|
||||
|
||||
# TODO: Test bookings clashes
|
||||
|
|
Loading…
Reference in a new issue