Skip to content

Commit

Permalink
Proxy error response from core (#1150)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfkonecn authored Sep 5, 2024
1 parent 26282ad commit 89ad73d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/org/mskcc/cbio/oncokb/web/rest/ApiProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ public ResponseEntity<String> proxy(@RequestBody(required = false) String body,
try {
return restTemplate.exchange(uri, method, new HttpEntity<>(body, httpHeaders), String.class);
} catch (HttpClientErrorException httpClientErrorException) {
if (httpClientErrorException.getStatusCode() != null && httpClientErrorException.getStatusCode().equals(HttpStatus.BAD_REQUEST)) {
throw new BadRequestAlertException(httpClientErrorException.getMessage(), "", "");
} else {
throw new ResponseStatusException(httpClientErrorException.getStatusCode(), httpClientErrorException.getMessage());
}
HttpHeaders responseHeaders = httpClientErrorException.getResponseHeaders();
return ResponseEntity
.status(httpClientErrorException.getStatusCode())
.headers(responseHeaders)
.body(httpClientErrorException.getResponseBodyAsString());
}
}

Expand Down

0 comments on commit 89ad73d

Please sign in to comment.