diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/RequestCopier.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/RequestCopier.java index bb80d9fbd..0c90fbc89 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/RequestCopier.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/RequestCopier.java @@ -46,13 +46,13 @@ public final class RequestCopier implements MessageCopier { if (original == null) { return null; } - final BasicHttpRequest copy = new BasicHttpRequest(original.getMethod(), original.getPath()); + final BasicHttpRequest copy = new BasicHttpRequest(original.getMethod(), null, original.getPath()); + copy.setScheme(original.getScheme()); + copy.setAuthority(original.getAuthority()); copy.setVersion(original.getVersion()); for (final Iterator
it = original.headerIterator(); it.hasNext(); ) { copy.addHeader(it.next()); } - copy.setScheme(original.getScheme()); - copy.setAuthority(original.getAuthority()); return copy; } diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ClassicRequestCopier.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ClassicRequestCopier.java index 21e2db336..8621d1c0d 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ClassicRequestCopier.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ClassicRequestCopier.java @@ -47,13 +47,13 @@ public final class ClassicRequestCopier implements MessageCopier it = original.headerIterator(); it.hasNext(); ) { copy.addHeader(it.next()); } - copy.setScheme(original.getScheme()); - copy.setAuthority(original.getAuthority()); copy.setEntity(original.getEntity()); return copy; }