Skip to content

Commit 6d16499

Browse files
committed
Merge pull request AsyncHttpClient#129 from nire/less_call
call getUrl() only once
2 parents ee8c6ea + 71fb642 commit 6d16499

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

api/src/main/java/com/ning/http/client/RequestBuilderBase.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ public RequestImpl(boolean useRawUrl) {
7575
public RequestImpl(Request prototype) {
7676
if (prototype != null) {
7777
this.method = prototype.getMethod();
78-
int pos = prototype.getUrl().indexOf("?");
79-
this.url = pos > 0 ? prototype.getUrl().substring(0, pos) : prototype.getUrl();
78+
String prototypeUrl = prototype.getUrl();
79+
int pos = prototypeUrl.indexOf("?");
80+
this.url = pos > 0 ? prototypeUrl.substring(0, pos) : prototypeUrl;
8081
this.address = prototype.getInetAddress();
8182
this.localAddress = prototype.getLocalAddress();
8283
this.headers = new FluentCaseInsensitiveStringsMap(prototype.getHeaders());

0 commit comments

Comments
 (0)