Describe the bug
We are automating multiple proxies initialization on custom ports using REST Assured (or and Java 11 HTTP client).
Attempts to start proxy on custom port with POST calls using the aforementioned tools end up with proxy starting but not on specified port.
Code for REST Assured:
String body = "port:"+ port;
//String body = "{\"port\":\""+ port +"\"}";
var response = given()
.body(body)
.log().all()
.when()
.post(proxyAddress)
.then().log().all();
Code for Java HTTP client:
String body = "port:"+ port;
//String body = "{\"port\":\""+ port +"\"}";
System.out.println(body);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(proxyAddress))
.timeout(Duration.ofMinutes(1))
.header("Content-Type", "text/plain")
.POST(BodyPublishers.ofString(body))
.build();
client.sendAsync(request, BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(System.out::println).join();
To Reproduce
Steps to reproduce the behavior:
Start BUP instance
Send a POST call using the code examples above
Proxy is started but on default port, e.g. response reads { "port": 8082 }
Same behavior is reproducible with text and JSON-formatted payload.
HTTP/1.1 200 OK
Date: Thu, 11 Jun 2020 10:19:29 GMT
Content-Type: application/json
Content-Length: 13
Server: Jetty(9.4.20.v20190813)
{
"port": 8089
}
Java client log:
[port:11001
{"port":8088}]
Expected behavior
Proxy should be started on the specified port.
Please complete the following information:
OS: Windows 10, Linux
Java: 11
Versions: 2.0.1, 2.1.0, 2.1.1
Additional context
Using curl for starting the proxy seems to work fine however we couldn't figure out how to incorporate this in our workflow or how to emulate it in Java.
Other POST call using REST Assured works fine - specifically, we are sending JSON-formatted hosts entries to http://(address}:8080/proxy/{port}/hosts and that is without problem.
Describe the bug We are automating multiple proxies initialization on custom ports using REST Assured (or and Java 11 HTTP client). Attempts to start proxy on custom port with POST calls using the aforementioned tools end up with proxy starting but not on specified port.
Code for REST Assured:
Code for Java HTTP client:
To Reproduce Steps to reproduce the behavior:
REST Assured logs: Example of request:
Respective response:
Java client log:
Expected behavior Proxy should be started on the specified port.
Please complete the following information:
Additional context Using curl for starting the proxy seems to work fine however we couldn't figure out how to incorporate this in our workflow or how to emulate it in Java.
Other POST call using REST Assured works fine - specifically, we are sending JSON-formatted hosts entries to http://(address}:8080/proxy/{port}/hosts and that is without problem.