Skip to content

Commit

Permalink
chore: fix result handling in proxy & get proyx URL from env
Browse files Browse the repository at this point in the history
  • Loading branch information
tmetzke authored and chillleader committed Dec 8, 2022
1 parent 8710b02 commit aeb4fee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public HttpJsonResult executeRequestDirectly(HttpJsonRequest request) throws IOE
public HttpJsonResult executeRequestViaProxy(String proxyUrl, HttpJsonRequest request)
throws IOException {

//String jsonString = gson.toJson(request);
//LOGGER.info("Sending request to proxy: " + jsonString);
// String jsonString = gson.toJson(request);
// LOGGER.info("Sending request to proxy: " + jsonString);

// Using the JsonHttpContent cannot work with an element on the root content??
// final HttpContent content = new JsonHttpContent(gsonFactory, jsonString);
Expand Down Expand Up @@ -115,9 +115,8 @@ public void writeTo(OutputStream outputStream) throws IOException {
"Failed to execute HTTP request: " + httpResponse.getStatusMessage());
}

try (InputStream responseContentStream = httpResponse.getContent();
Reader reader = new InputStreamReader(responseContentStream)) {
final HttpJsonResult jsonResult = gson.fromJson(reader, HttpJsonResult.class);
try {
final HttpJsonResult jsonResult = toHttpJsonResponse(httpResponse);

LOGGER.info("Proxy returned result: " + jsonResult);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public HttpJsonFunction(
this.gson = gson;
this.http = new HttpInvocationHelper(gson, requestFactory, gsonFactory);

//proxyFunctionToUse = Optional.of("http://localhost:8080/function-connector-http-proxy-function-test1");
proxyFunctionToUse = Optional.ofNullable(System.getenv("PROXY_FUNCTION_URL"));
}

@Override
Expand Down

0 comments on commit aeb4fee

Please sign in to comment.