Skip to content

Commit

Permalink
comments
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 Jul 8, 2020
1 parent f263572 commit 6354901
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion documentation/book/api/overview.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ __Terms of service__ : http://swagger.io/terms/

=== URI scheme
[%hardbreaks]
__Host__ : bridge.swagger.io
__BasePath__ : /
__Schemes__ : HTTP

Expand Down
11 changes: 8 additions & 3 deletions src/main/java/io/strimzi/kafka/bridge/http/HttpBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,14 @@ private void openapi(RoutingContext routingContext) {
if (readFile.succeeded()) {
JsonObject json = (JsonObject) Json.decodeValue(readFile.result());
String xForwardedPath = routingContext.request().getHeader("x-forwarded-path");
String path = (xForwardedPath != null && !xForwardedPath.isEmpty()) ? xForwardedPath : "/";
json.put("basePath", path);
HttpUtils.sendResponse(routingContext, HttpResponseStatus.OK.code(), BridgeContentType.JSON, json.toBuffer());
String xForwardedPrefix = routingContext.request().getHeader("x-forwarded-prefix");
if (xForwardedPath == null && xForwardedPrefix == null) {
HttpUtils.sendFile(routingContext, HttpResponseStatus.OK.code(), BridgeContentType.JSON, "openapiv2.json");
} else {
String path = (xForwardedPath != null && !xForwardedPath.isEmpty()) ? xForwardedPath : "/";
json.put("basePath", path);
HttpUtils.sendResponse(routingContext, HttpResponseStatus.OK.code(), BridgeContentType.JSON, json.toBuffer());
}
} else {
HttpBridgeError error = new HttpBridgeError(
HttpResponseStatus.INTERNAL_SERVER_ERROR.code(),
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/openapiv2.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
},
"version": "0.1.0"
},
"host": "bridge.swagger.io",
"basePath": "/",
"schemes": [
"http"
Expand Down

0 comments on commit 6354901

Please sign in to comment.