Skip to content

Commit 1b09ce8

Browse files
BENCH-162 Updated status codes for create product and category
1 parent a803a43 commit 1b09ce8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/com/answerdigital/answerking/controller/CategoryController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public CategoryController(final CategoryService categoryService) {
4545
public ResponseEntity<Category> addCategory(@Valid @RequestBody final AddCategoryRequest categoryRequest,
4646
final Errors errors) {
4747
return new ResponseEntity<>(categoryService.addCategory(categoryRequest),
48-
errors.hasErrors() ? HttpStatus.BAD_REQUEST : HttpStatus.OK);
48+
errors.hasErrors() ? HttpStatus.BAD_REQUEST : HttpStatus.CREATED);
4949
}
5050

5151
@Operation(summary = "Get all categories.")

src/main/java/com/answerdigital/answerking/controller/ProductController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public ResponseEntity<Product> getProductById(@Valid @PathVariable @NotNull fina
4848
@PostMapping
4949
public ResponseEntity<Product> addProduct(@Valid @RequestBody final ProductRequest productRequest, final Errors errors) {
5050
return new ResponseEntity<>(productService.addNewProduct(productRequest),
51-
errors.hasErrors() ? HttpStatus.BAD_REQUEST : HttpStatus.OK);
51+
errors.hasErrors() ? HttpStatus.BAD_REQUEST : HttpStatus.CREATED);
5252
}
5353

5454
@PutMapping("/{id}")

0 commit comments

Comments
 (0)