svkcemk commented on code in PR #8436:
URL: https://github.com/apache/camel-quarkus/pull/8436#discussion_r2954455223
##########
integration-test-groups/http/http/src/test/java/org/apache/camel/quarkus/component/http/http/it/HttpTest.java:
##########
@@ -91,4 +93,57 @@ public void compression() {
.body(is("Compressed response"));
}
+ @Test
+ public void testNonProxyRouting() {
+
+ Config config = ConfigProvider.getConfig();
+ // Actual correct proxy host and port
+ String proxyHost = config.getValue("proxy.host", String.class);
+ Integer proxyPort = config.getValue("proxy.port", Integer.class);
+ // Wrong proxy port
+ Integer fakeProxyPort = RestAssured.port;
+ //Direct call to target host skipping the proxy using non-proxy-hosts
+ RestAssured.given()
+ .queryParam("non-proxy-hosts", "repo.maven.apache.org")
+ .queryParam("proxy-port", proxyPort)
+ .queryParam("proxy-host", proxyHost)
+ .when()
+ .get("/test/client/{component}/nonProxy", component())
+ .then()
+ .statusCode(200)
+ .body("metadata.groupId", is("org.apache.camel.quarkus"));
+
+ //Direct call to target host skipping the proxy using non-proxy-hosts
( using wrong/fake proxy port )
+ RestAssured.given()
+ .queryParam("non-proxy-hosts", "repo.maven.apache.org")
+ .queryParam("proxy-port", proxyPort)
+ .queryParam("proxy-host", fakeProxyPort)
+ .when()
+ .get("/test/client/{component}/nonProxy", component())
+ .then()
+ .statusCode(200)
+ .body("metadata.groupId", is("org.apache.camel.quarkus"));
+
+ //Direct call to target host skipping the proxy using nonproxyhost
list as wildcard ( using wrong/fake proxy port )
+ RestAssured.given()
+ .queryParam("non-proxy-hosts", "*apache.org|.apache.org")
+ .queryParam("proxy-port", fakeProxyPort)
+ .queryParam("proxy-host", proxyHost)
+ .when()
+ .get("/test/client/{component}/nonProxy", component())
+ .then()
+ .statusCode(200)
+ .body("metadata.groupId", is("org.apache.camel.quarkus"));
+ //Request will go throgh the proxy host since using wrong
nonProxyHosts point to localhost (using wrong/fake proxy port)
+ RestAssured.given()
+ .queryParam("non-proxy-hosts", "*localhost*")
+ .queryParam("proxy-port", fakeProxyPort)
+ .queryParam("proxy-host", proxyHost)
+ .when()
+ .get("/test/client/{component}/nonProxy", component())
+ .then()
+ .statusCode(500);
+
+ }
Review Comment:
@apupier I tried to clean up the tests using `ParameterizedTest`could you
mind to take a look please
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]