Skip to content

Commit

Permalink
NOJIRA
Browse files Browse the repository at this point in the history
Correcting the header location path for responses from the controller
  • Loading branch information
chasegawa committed May 25, 2021
1 parent e6096b0 commit da4c142
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public ResponseEntity<?> create(@RequestBody CustomEntityAttributeDefinition def

if (cad != null) {
HttpHeaders headers = new HttpHeaders();
headers.setLocation(ServletUriComponentsBuilder.fromCurrentServletMapping().path("/api/custom/attribute").build().toUri());
headers.setLocation(ServletUriComponentsBuilder.fromCurrentServletMapping().path("/api/custom/entity/attribute").build().toUri());

return ResponseEntity.status(HttpStatus.CONFLICT).headers(headers)
.body(new ErrorResponse(String.valueOf(HttpStatus.CONFLICT.value()),
Expand All @@ -52,7 +52,7 @@ public ResponseEntity<?> update(@RequestBody CustomEntityAttributeDefinition def
CustomEntityAttributeDefinition cad = caService.find(definition.getName());
if (cad == null) {
HttpHeaders headers = new HttpHeaders();
headers.setLocation(ServletUriComponentsBuilder.fromCurrentServletMapping().path("/api/custom/attribute").build().toUri());
headers.setLocation(ServletUriComponentsBuilder.fromCurrentServletMapping().path("/api/custom/entity/attribute").build().toUri());

return ResponseEntity.status(HttpStatus.NOT_FOUND).headers(headers)
.body(new ErrorResponse(String.valueOf(HttpStatus.NOT_FOUND.value()),
Expand All @@ -76,7 +76,7 @@ public ResponseEntity<?> getOne(@PathVariable String name) {
if (cad == null) {
HttpHeaders headers = new HttpHeaders();
headers.setLocation(
ServletUriComponentsBuilder.fromCurrentServletMapping().path("/api/custom/attribute/" + name).build().toUri());
ServletUriComponentsBuilder.fromCurrentServletMapping().path("/api/custom/entity/attribute/" + name).build().toUri());

return ResponseEntity.status(HttpStatus.NOT_FOUND).headers(headers)
.body(new ErrorResponse(String.valueOf(HttpStatus.NOT_FOUND.value()),
Expand Down

0 comments on commit da4c142

Please sign in to comment.