Skip to content

Commit

Permalink
wip issue #8
Browse files Browse the repository at this point in the history
  • Loading branch information
dartpopikyardo committed Sep 5, 2016
1 parent c9fa916 commit e2de325
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.springframework.http.ResponseEntity;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException;

Expand Down Expand Up @@ -57,12 +58,13 @@ public void init() {
}

@RequestMapping(value = "/api/**", method = {GET, POST})
public ResponseEntity<String> proxyRequest(HttpServletRequest request) throws NoSuchRequestHandlingMethodException, IOException, URISyntaxException {
@ResponseBody
public String proxyRequest(HttpServletRequest request) throws NoSuchRequestHandlingMethodException, IOException, URISyntaxException {
HttpUriRequest proxiedRequest = createHttpUriRequest(request);
logger.info("request: {}", proxiedRequest);
HttpResponse proxiedResponse = httpClient.execute(proxiedRequest);
logger.info("Response {}", proxiedResponse.getStatusLine().getStatusCode());
return new ResponseEntity<>(read(proxiedResponse.getEntity().getContent()), processHeaders(proxiedResponse.getAllHeaders()), HttpStatus.valueOf(proxiedResponse.getStatusLine().getStatusCode()));
return read(proxiedResponse.getEntity().getContent());
}

private HttpHeaders processHeaders(Header[] headers) {
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit e2de325

Please sign in to comment.