Skip to content

Commit

Permalink
Merge pull request #57 from techorgx/correct-httpstatus-in-response
Browse files Browse the repository at this point in the history
Using appropriate http status while responding
  • Loading branch information
amansinghrajpoot authored Dec 8, 2023
2 parents 044a215 + efb5de0 commit bcb89c5
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class CustomerController {
public ResponseEntity<String> addCustomer(@RequestBody CustomerRequestModel cm) {
String customerId = cs.saveCustomer(cm);
if (customerId != null) {
return new ResponseEntity<>(customerId, HttpStatus.ACCEPTED);
return new ResponseEntity<>(customerId, HttpStatus.CREATED);
}
return new ResponseEntity<>(HttpStatus.CONFLICT);
}
Expand All @@ -45,7 +45,7 @@ public HttpStatus deleteCustomer(@RequestParam(name = "id") String id){
} catch (Exception e) {
return HttpStatus.INTERNAL_SERVER_ERROR;
}
return HttpStatus.ACCEPTED;
return HttpStatus.OK;
}

@PutMapping(path = "/update-customer", produces = MediaType.APPLICATION_JSON_VALUE)
Expand All @@ -55,6 +55,6 @@ public HttpStatus updateCustomer(@RequestBody CustomerRequestModel cm) {
} catch (Exception e) {
return HttpStatus.INTERNAL_SERVER_ERROR;
}
return HttpStatus.ACCEPTED;
return HttpStatus.OK;
}
}

0 comments on commit bcb89c5

Please sign in to comment.