From e70efd0b531b4efaf711aceb1fb33bf2bfd1fcfb Mon Sep 17 00:00:00 2001 From: Bjørn Christian Seime Date: Tue, 25 May 2021 15:03:36 +0200 Subject: Upgrade httpclient5 to 5.1 --- .../java/ai/vespa/hosted/client/AbstractConfigServerClient.java | 6 ++++-- .../java/ai/vespa/hosted/client/HttpConfigServerClientTest.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'configserver-client/src') 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())); } -- cgit v1.2.3