Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
Signed-off-by: Stanislav Knot <sknot@redhat.com>
  • Loading branch information
sknot-rh committed Jun 2, 2021
1 parent 7c038fa commit b834225
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/test/java/io/strimzi/kafka/bridge/http/OtherServicesIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,44 @@ void openApiTestWithForwardedPath(VertxTestContext context) {
context.completeNow();
});
}

@Test
void openApiTestWithForwardedPrefix(VertxTestContext context) {
String forwardedPrefix = "/app/kafka-bridge";
baseService()
.getRequest("/openapi")
.putHeader("x-Forwarded-Prefix", forwardedPrefix)
.as(BodyCodec.jsonObject())
.send(ar -> {
context.verify(() -> {
assertThat(ar.succeeded(), is(true));
HttpResponse<JsonObject> response = ar.result();
assertThat(response.statusCode(), is(HttpResponseStatus.OK.code()));
JsonObject bridgeResponse = response.body();
assertThat(bridgeResponse.getString("basePath"), is(forwardedPrefix));
});
context.completeNow();
});
}

@Test
void openApiTestWithForwardedPathAndPrefix(VertxTestContext context) {
String forwardedPath = "/app/kafka-bridge-path";
String forwardedPrefix = "/app/kafka-bridge-prefix";
baseService()
.getRequest("/openapi")
.putHeader("x-Forwarded-Path", forwardedPath)
.putHeader("x-Forwarded-Prefix", forwardedPrefix)
.as(BodyCodec.jsonObject())
.send(ar -> {
context.verify(() -> {
assertThat(ar.succeeded(), is(true));
HttpResponse<JsonObject> response = ar.result();
assertThat(response.statusCode(), is(HttpResponseStatus.OK.code()));
JsonObject bridgeResponse = response.body();
assertThat(bridgeResponse.getString("basePath"), is(forwardedPath));
});
context.completeNow();
});
}
}

0 comments on commit b834225

Please sign in to comment.