Skip to content

Commit

Permalink
Use URI String as fallback in ReactorClientHttpConnector
Browse files Browse the repository at this point in the history
Closes gh-31033
  • Loading branch information
rstoyanchev committed Sep 27, 2023
1 parent 35f458f commit 957b6b2
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public Mono<ClientHttpResponse> connect(HttpMethod method, URI uri,
HttpClient.RequestSender requestSender = this.httpClient
.request(io.netty.handler.codec.http.HttpMethod.valueOf(method.name()));

requestSender = (uri.isAbsolute() ? requestSender.uri(uri) : requestSender.uri(uri.toString()));
requestSender = setUri(requestSender, uri);

return requestSender
.send((request, outbound) -> requestCallback.apply(adaptRequest(method, uri, request, outbound)))
Expand All @@ -125,6 +125,18 @@ public Mono<ClientHttpResponse> connect(HttpMethod method, URI uri,
});
}

private static HttpClient.RequestSender setUri(HttpClient.RequestSender requestSender, URI uri) {
if (uri.isAbsolute()) {
try {
return requestSender.uri(uri);
}
catch (Exception ex) {
// Fall back on passing it in as a String
}
}
return requestSender.uri(uri.toString());
}

private ReactorClientHttpRequest adaptRequest(HttpMethod method, URI uri, HttpClientRequest request,
NettyOutbound nettyOutbound) {

Expand Down

0 comments on commit 957b6b2

Please sign in to comment.