Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check of passing HTTP status error through #657

Merged
merged 1 commit into from
May 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
@@ -22,7 +23,7 @@ public interface ProxyClient {
@GET
@Path("/example.txt")
@Produces(MediaType.TEXT_PLAIN)
Uni<String> getText();
Uni<Response> getText();

@GET
@Path("/auth")
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.eclipse.microprofile.rest.client.inject.RestClient;

@@ -27,7 +28,7 @@ public Uni<String> getRoot() {
@GET
@Path("/banned")
@Produces(MediaType.TEXT_PLAIN)
public Uni<String> getBanned() {
public Uni<Response> getBanned() {
return client.getText();
}

Original file line number Diff line number Diff line change
@@ -3,4 +3,5 @@ quarkus.rest-client."io.quarkus.ts.http.restclient.reactive.proxy.ProxyClient".p
quarkus.rest-client."io.quarkus.ts.http.restclient.reactive.proxy.ProxyClient".proxy-user=proxyuser
quarkus.rest-client."io.quarkus.ts.http.restclient.reactive.proxy.ProxyClient".proxy-password=proxypassword
quarkus.rest-client.logging.scope=request-response
quarkus.log.category."org.jboss.resteasy.reactive.client.logging".level=DEBUG
quarkus.log.category."org.jboss.resteasy.reactive.client.logging".level=INFO
microprofile.rest.client.disable.default.mapper=true
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ void getThrough() {
@Test
void banned() {
Response banned = proxyApp.given().with().get("/proxied/banned");
Assertions.assertEquals(HttpStatus.SC_OK, banned.statusCode());
Assertions.assertEquals(HttpStatus.SC_FORBIDDEN, banned.statusCode());
Assertions.assertEquals("Reading is prohibited by corporate policy!",
banned.body().asString());
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
FROM nginx:1.21
EXPOSE 8090
COPY nginx.conf /etc/nginx/nginx.conf
3 changes: 3 additions & 0 deletions http/rest-client-reactive/src/test/resources/proxy/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
VERSION=1.0.1
docker build -t nginx-proxy .
docker tag nginx-proxy quay.io/quarkusqeteam/proxy:latest
docker tag nginx-proxy quay.io/quarkusqeteam/proxy:$VERSION
docker push quay.io/quarkusqeteam/proxy:latest
docker push quay.io/quarkusqeteam/proxy:$VERSION
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ http {
proxy_pass http://$host;
}
location ~ \.(txt)$ {
return 203 "Reading is prohibited by corporate policy!";
return 403 "Reading is prohibited by corporate policy!";
}
location /auth {
return 200 $http_proxy_authorization;