Skip to content

Commit 89ad73d

Browse files
authored
Proxy error response from core (#1150)
1 parent 26282ad commit 89ad73d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/org/mskcc/cbio/oncokb/web/rest/ApiProxy.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ public ResponseEntity<String> proxy(@RequestBody(required = false) String body,
8686
try {
8787
return restTemplate.exchange(uri, method, new HttpEntity<>(body, httpHeaders), String.class);
8888
} catch (HttpClientErrorException httpClientErrorException) {
89-
if (httpClientErrorException.getStatusCode() != null && httpClientErrorException.getStatusCode().equals(HttpStatus.BAD_REQUEST)) {
90-
throw new BadRequestAlertException(httpClientErrorException.getMessage(), "", "");
91-
} else {
92-
throw new ResponseStatusException(httpClientErrorException.getStatusCode(), httpClientErrorException.getMessage());
93-
}
89+
HttpHeaders responseHeaders = httpClientErrorException.getResponseHeaders();
90+
return ResponseEntity
91+
.status(httpClientErrorException.getStatusCode())
92+
.headers(responseHeaders)
93+
.body(httpClientErrorException.getResponseBodyAsString());
9494
}
9595
}
9696

0 commit comments

Comments
 (0)