🚧 Fixed bug
This commit is contained in:
parent
0bc2a63471
commit
c7efe8f780
@ -54,7 +54,7 @@ public class ProxyResource
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Route(path = "/*", order = 1)
|
@Route(path = "/*", order = 1)
|
||||||
public void proxy(@Context RoutingContext context)
|
public void proxy(@Context RoutingContext context, byte[] body)
|
||||||
{
|
{
|
||||||
List<String> requestSegments = Arrays.stream(context.request().path().split("/")).filter(item -> !StringUtils.isBlank(item)).toList();
|
List<String> requestSegments = Arrays.stream(context.request().path().split("/")).filter(item -> !StringUtils.isBlank(item)).toList();
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ public class ProxyResource
|
|||||||
LOG.info("Matched route with target '{}'", route.target());
|
LOG.info("Matched route with target '{}'", route.target());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HttpResponse<byte[]> response = forward(context.request().headers(), context.request().method(), route.strategy(), extractSession(context.request().cookies()), route.target(), concat(dropRoute(route.segments(), requestSegments)));
|
HttpResponse<byte[]> response = forward(context.request().headers(), context.request().method(), body, route.strategy(), extractSession(context.request().cookies()), route.target(), concat(dropRoute(route.segments(), requestSegments)));
|
||||||
ResponseHandler.success(context, response);
|
ResponseHandler.success(context, response);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -81,9 +81,9 @@ public class ProxyResource
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpResponse<byte[]> forward(MultiMap headers, HttpMethod method, String strategy, String auth, String forwardRoot, String forwardPath) throws IOException, InterruptedException
|
public HttpResponse<byte[]> forward(MultiMap headers, HttpMethod method, byte[] body, String strategy, String auth, String forwardRoot, String forwardPath) throws IOException, InterruptedException
|
||||||
{
|
{
|
||||||
HttpRequest.Builder builder = HttpRequest.newBuilder().method(method.name(), HttpRequest.BodyPublishers.noBody()).uri(URI.create(forwardRoot + "/" + forwardPath));
|
HttpRequest.Builder builder = HttpRequest.newBuilder().method(method.name(), HttpRequest.BodyPublishers.ofByteArray(body)).uri(URI.create(forwardRoot + "/" + forwardPath));
|
||||||
for (Map.Entry<String, String> entry : headers.entries())
|
for (Map.Entry<String, String> entry : headers.entries())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user