diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2021-05-25 15:03:36 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2021-05-25 15:30:38 +0200 |
commit | e70efd0b531b4efaf711aceb1fb33bf2bfd1fcfb (patch) | |
tree | 2bdd94d53ed5fc253b3f752a6235a09031960e7d /configserver-client | |
parent | 4253678ce7d9a5862f6c6804855167e186901ba3 (diff) |
Upgrade httpclient5 to 5.1
Diffstat (limited to 'configserver-client')
-rw-r--r-- | configserver-client/src/main/java/ai/vespa/hosted/client/AbstractConfigServerClient.java | 6 | ||||
-rw-r--r-- | configserver-client/src/test/java/ai/vespa/hosted/client/HttpConfigServerClientTest.java | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/configserver-client/src/main/java/ai/vespa/hosted/client/AbstractConfigServerClient.java b/configserver-client/src/main/java/ai/vespa/hosted/client/AbstractConfigServerClient.java index 608e9fe18b4..910f7a1402b 100644 --- a/configserver-client/src/main/java/ai/vespa/hosted/client/AbstractConfigServerClient.java +++ b/configserver-client/src/main/java/ai/vespa/hosted/client/AbstractConfigServerClient.java @@ -1,7 +1,6 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package ai.vespa.hosted.client; -import org.apache.hc.client5.http.classic.methods.ClassicHttpRequests; import org.apache.hc.client5.http.config.RequestConfig; import org.apache.hc.client5.http.protocol.HttpClientContext; import org.apache.hc.core5.http.ClassicHttpRequest; @@ -12,6 +11,7 @@ import org.apache.hc.core5.http.Method; import org.apache.hc.core5.http.ParseException; import org.apache.hc.core5.http.io.entity.EntityUtils; import org.apache.hc.core5.http.io.entity.HttpEntities; +import org.apache.hc.core5.http.io.support.ClassicRequestBuilder; import org.apache.hc.core5.net.URIBuilder; import java.io.IOException; @@ -49,7 +49,9 @@ public abstract class AbstractConfigServerClient implements ConfigServerClient { Throwable thrown = null; for (URI host : builder.hosts) { - ClassicHttpRequest request = ClassicHttpRequests.create(builder.method, concat(host, builder.uriBuilder)); + ClassicHttpRequest request = ClassicRequestBuilder.create(builder.method.name()) + .setUri(concat(host, builder.uriBuilder)) + .build(); request.setEntity(builder.entity); try { try { diff --git a/configserver-client/src/test/java/ai/vespa/hosted/client/HttpConfigServerClientTest.java b/configserver-client/src/test/java/ai/vespa/hosted/client/HttpConfigServerClientTest.java index b2f17f43f5c..956bc90380f 100644 --- a/configserver-client/src/test/java/ai/vespa/hosted/client/HttpConfigServerClientTest.java +++ b/configserver-client/src/test/java/ai/vespa/hosted/client/HttpConfigServerClientTest.java @@ -89,7 +89,7 @@ class HttpConfigServerClientTest { () -> client.send(HostStrategy.repeating(URI.create("http://localhost:" + server.port()), 10), Method.GET) .read(String::new)); - assertEquals("GET / failed with status 409 and body 'hi'", thrown.getMessage()); + assertEquals("GET http://localhost:" + server.port() + "/ failed with status 409 and body 'hi'", thrown.getMessage()); server.verify(1, getRequestedFor(urlEqualTo("/"))); server.verify(1, anyRequestedFor(anyUrl())); } |