-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22649 from michalszynkiewicz/rest-client-reactive…
…-no-proxy-hosts Support non-proxy hosts in REST Client Reactive
- Loading branch information
Showing
16 changed files
with
219 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...ient-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/proxy/Client5.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.quarkus.rest.client.reactive.proxy; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.core.Response; | ||
|
||
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; | ||
|
||
@RegisterRestClient(configKey = "client5") | ||
@Path("/resource") | ||
public interface Client5 { | ||
@GET | ||
Response get(); | ||
} |
14 changes: 14 additions & 0 deletions
14
...ient-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/proxy/Client6.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.quarkus.rest.client.reactive.proxy; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.core.Response; | ||
|
||
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; | ||
|
||
@RegisterRestClient(configKey = "client6") | ||
@Path("/resource") | ||
public interface Client6 { | ||
@GET | ||
Response get(); | ||
} |
37 changes: 37 additions & 0 deletions
37
...ve/deployment/src/test/java/io/quarkus/rest/client/reactive/proxy/GlobalNonProxyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.quarkus.rest.client.reactive.proxy; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import javax.ws.rs.core.Response; | ||
|
||
import org.eclipse.microprofile.rest.client.RestClientBuilder; | ||
import org.eclipse.microprofile.rest.client.inject.RestClient; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class GlobalNonProxyTest extends ProxyTestBase { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot( | ||
jar -> jar.addClasses(Client1.class, Client2.class, Client3.class, Client4.class, Client5.class, | ||
Client6.class, ViaHeaderReturningResource.class)) | ||
.withConfigurationResource("global-non-proxy-test-application.properties"); | ||
|
||
@RestClient | ||
Client1 client1; | ||
|
||
@Test | ||
void shouldNotApplyProxyIfNonProxyMatches() { | ||
assertThat(client1.get().readEntity(String.class)).isEqualTo(NO_PROXY); | ||
} | ||
|
||
@Test | ||
void shouldProxyBuilderWithPerClientSettings() { | ||
Response response = RestClientBuilder.newBuilder().baseUri(appUri) | ||
.build(Client1.class).get(); | ||
assertThat(response.readEntity(String.class)).isEqualTo(NO_PROXY); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...lient-reactive/deployment/src/test/resources/global-non-proxy-test-application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
quarkus.rest-client.proxy-address=localhost:8182 | ||
quarkus.rest-client.non-proxy-hosts=localhost | ||
|
||
quarkus.rest-client.client1.url=http://localhost:${quarkus.http.test-port:8081}/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.