Skip to content

Commit

Permalink
cleanup proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
bprize15 committed Jun 21, 2024
1 parent eb0f82d commit a8b1506
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 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 @@ -64,7 +64,7 @@ public class ApiProxy {

private String IP_HEADER = "X-FORWARDED-FOR";

@RequestMapping(path = "/**", method = {RequestMethod.GET, RequestMethod.POST, RequestMethod.PUT, RequestMethod.PATCH, RequestMethod.DELETE, RequestMethod.HEAD})
@RequestMapping(path = "/**", method = {RequestMethod.GET, RequestMethod.POST, RequestMethod.HEAD})
public ResponseEntity<String> proxy(@RequestBody(required = false) String body, HttpMethod method, HttpServletRequest request)
throws URISyntaxException {
URI uri = apiProxyService.prepareURI(request);
Expand All @@ -84,10 +84,6 @@ public ResponseEntity<String> proxy(@RequestBody(required = false) String body,
restTemplate.getMessageConverters().add(0, new StringHttpMessageConverter(StandardCharsets.UTF_8));

try {
if (method.equals(HttpMethod.HEAD)) {
ResponseEntity<String> response = restTemplate.exchange(uri, HttpMethod.GET, new HttpEntity<>(body, httpHeaders), String.class);
return new ResponseEntity<>(response.getHeaders(), response.getStatusCode());
}
return restTemplate.exchange(uri, method, new HttpEntity<>(body, httpHeaders), String.class);
} catch (HttpClientErrorException httpClientErrorException) {
if (httpClientErrorException.getStatusCode() != null && httpClientErrorException.getStatusCode().equals(HttpStatus.BAD_REQUEST)) {
Expand Down

0 comments on commit a8b1506

Please sign in to comment.