Skip to content

Commit 6d89c76

Browse files
Fixed 500 Error when getProductByID
1 parent 97165a5 commit 6d89c76

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ public ResponseEntity<List<Product>> getAllProducts() {
5858
content = { @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) })
5959
})
6060
@GetMapping(path = "/{id}")
61-
public ResponseEntity<Product> getProductById(@Valid @PathVariable @NotNull final Long id, final Errors errors) {
62-
return new ResponseEntity<>(productService.findById(id),
63-
errors.hasErrors() ? HttpStatus.NOT_FOUND : HttpStatus.OK);
61+
public ResponseEntity<Product> getProductById(@Valid @PathVariable @NotNull final Long id) {
62+
return new ResponseEntity<>(productService.findById(id), HttpStatus.OK);
6463
}
6564

6665
@Operation(summary = "Create a new product.")

0 commit comments

Comments
 (0)