Skip to content

Commit 14a5ff5

Browse files
Change port from 400 to 422
Signed-off-by: Christian Wolf <[email protected]>
1 parent ae23e6e commit 14a5ff5

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

docs/dev/api/0.0.3/openapi-cookbook.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -424,14 +424,14 @@ paths:
424424
type: integer
425425
example: 2462
426426
description: The id of the newly created recipe
427-
400:
428-
description: There was no name in the request given for the recipe. Cannot save the recipe.
427+
409:
428+
description: A recipe with the name was already found on the server. No recipe is created.
429429
content:
430430
application/json:
431431
schema:
432432
$ref: "#/components/schemas/Error"
433-
409:
434-
description: A recipe with the name was already found on the server. No recipe is created.
433+
422:
434+
description: There was no name in the request given for the recipe. Cannot save the recipe.
435435
content:
436436
application/json:
437437
schema:
@@ -479,7 +479,7 @@ paths:
479479
type: integer
480480
description: The id of the updated recipe
481481
example: 2345
482-
400:
482+
422:
483483
description: There was no name in the request given for the recipe. Cannot save the recipe.
484484
content:
485485
application/json:

lib/Controller/RecipeController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function update($id) {
109109
'file' => $ex->getFile(),
110110
'line' => $ex->getLine(),
111111
];
112-
return new JSONResponse($json, Http::STATUS_BAD_REQUEST);
112+
return new JSONResponse($json, Http::STATUS_UNPROCESSABLE_ENTITY);
113113
}
114114
$this->dbCacheService->addRecipe($file);
115115

@@ -148,7 +148,7 @@ public function create() {
148148
'file' => $ex->getFile(),
149149
'line' => $ex->getLine(),
150150
];
151-
return new JSONResponse($json, Http::STATUS_BAD_REQUEST);
151+
return new JSONResponse($json, Http::STATUS_UNPROCESSABLE_ENTITY);
152152
}
153153
}
154154

src/components/RecipeEdit.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,8 @@ export default {
596596
// Non 2xx state returned
597597
598598
switch (e.response.status) {
599-
case 400:
600599
case 409:
600+
case 422:
601601
// eslint-disable-next-line no-alert
602602
alert(e.response.data.msg)
603603
break

tests/Unit/Controller/RecipeControllerTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function testUpdateNoName(): void {
111111

112112
$ret = $this->sut->update(1);
113113

114-
$this->assertEquals(400, $ret->getStatus());
114+
$this->assertEquals(422, $ret->getStatus());
115115
$this->assertEquals($errorMsg, $ret->getData()['msg']);
116116
}
117117

@@ -154,7 +154,7 @@ public function testCreateNoName(): void {
154154

155155
$ret = $this->sut->create();
156156

157-
$this->assertEquals(400, $ret->getStatus());
157+
$this->assertEquals(422, $ret->getStatus());
158158
$this->assertEquals($errorMsg, $ret->getData()['msg']);
159159
}
160160

0 commit comments

Comments
 (0)