fix mutator() calls in URL building
This commit is contained in:
parent
28cdfcfb57
commit
c3d65df2e0
3 changed files with 10 additions and 10 deletions
|
@ -1,13 +1,13 @@
|
||||||
group = org.xbib
|
group = org.xbib
|
||||||
name = netty-http
|
name = netty-http
|
||||||
version = 4.1.38.1
|
version = 4.1.38.2
|
||||||
|
|
||||||
# main packages
|
# main packages
|
||||||
netty.version = 4.1.38.Final
|
netty.version = 4.1.38.Final
|
||||||
tcnative.version = 2.0.25.Final
|
tcnative.version = 2.0.25.Final
|
||||||
|
|
||||||
# common
|
# common
|
||||||
xbib-net-url.version = 1.3.3
|
xbib-net-url.version = 1.3.4
|
||||||
|
|
||||||
# server
|
# server
|
||||||
bouncycastle.version = 1.61
|
bouncycastle.version = 1.61
|
||||||
|
|
|
@ -39,6 +39,7 @@ import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -520,9 +521,6 @@ public class Request {
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
throw new IllegalStateException("URL not set");
|
throw new IllegalStateException("URL not set");
|
||||||
}
|
}
|
||||||
if (url.getHost() == null) {
|
|
||||||
throw new IllegalStateException("host in URL not defined: " + url);
|
|
||||||
}
|
|
||||||
// form parameters
|
// form parameters
|
||||||
if (!formParameters.isEmpty()) {
|
if (!formParameters.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
|
@ -533,9 +531,10 @@ public class Request {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// attach user query parameters to URL
|
// attach user query parameters to URL
|
||||||
URL.Builder builder = url.newBuilder();
|
URL.Builder mutator = url.mutator();
|
||||||
uriParameters.forEach((k, v) -> v.forEach(value -> builder.queryParam(k, value)));
|
uriParameters.forEach((k, v) -> v.forEach(value -> mutator.queryParam(k, value)));
|
||||||
url = builder.build();
|
url = mutator.build();
|
||||||
|
Objects.requireNonNull(url.getHost());
|
||||||
// let Netty's query string decoder/encoder work over the URL to add parameters given implicitly in url()
|
// let Netty's query string decoder/encoder work over the URL to add parameters given implicitly in url()
|
||||||
String path = url.getPath();
|
String path = url.getPath();
|
||||||
String query = url.getQuery();
|
String query = url.getQuery();
|
||||||
|
|
|
@ -225,7 +225,7 @@ class EndpointTest {
|
||||||
client.execute(request).get();
|
client.execute(request).get();
|
||||||
Request request1 = Request.get().setVersion(HttpVersion.HTTP_1_1)
|
Request request1 = Request.get().setVersion(HttpVersion.HTTP_1_1)
|
||||||
.url(server.getServerConfig().getAddress().base()
|
.url(server.getServerConfig().getAddress().base()
|
||||||
.resolve("/static1/test1.txt").newBuilder().fragment("frag").build())
|
.resolve("/static1/test1.txt").mutator().fragment("frag").build())
|
||||||
.build()
|
.build()
|
||||||
.setResponseListener(resp -> {
|
.setResponseListener(resp -> {
|
||||||
if (resp.getStatus().getCode() == HttpResponseStatus.OK.code()) {
|
if (resp.getStatus().getCode() == HttpResponseStatus.OK.code()) {
|
||||||
|
@ -237,7 +237,8 @@ class EndpointTest {
|
||||||
});
|
});
|
||||||
client.execute(request1).get();
|
client.execute(request1).get();
|
||||||
Request request2 = Request.get().setVersion(HttpVersion.HTTP_1_1)
|
Request request2 = Request.get().setVersion(HttpVersion.HTTP_1_1)
|
||||||
.url(server.getServerConfig().getAddress().base().resolve("/static2/test2.txt"))
|
.url(server.getServerConfig().getAddress().base()
|
||||||
|
.resolve("/static2/test2.txt"))
|
||||||
.content("{\"a\":\"b\"}","application/json")
|
.content("{\"a\":\"b\"}","application/json")
|
||||||
.build()
|
.build()
|
||||||
.setResponseListener(resp -> {
|
.setResponseListener(resp -> {
|
||||||
|
|
Loading…
Reference in a new issue