Skip to content

Commit 1ac29fe

Browse files
authored
Merge pull request #324 from SentryMan/path
[http-client] Reset base if an http scheme is detected
2 parents 14f5d74 + c87cddb commit 1ac29fe

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

http-client/src/main/java/io/avaje/http/client/DUrlBuilder.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,22 @@ final class DUrlBuilder implements UrlBuilder {
1515

1616
@Override
1717
public UrlBuilder url(String url) {
18-
buffer.delete(0, buffer.length());
18+
19+
if (url.startsWith("http") && url.contains("://")) {
20+
buffer.setLength(0);
21+
}
22+
1923
buffer.append(url);
2024
return this;
2125
}
2226

2327
@Override
2428
public UrlBuilder path(String path) {
29+
if (path.startsWith("http") && path.contains("://")) {
30+
buffer.setLength(0);
31+
buffer.append(path);
32+
return this;
33+
}
2534
buffer.append("/").append(path);
2635
return this;
2736
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package io.avaje.http.generator.client.clients;
2+
3+
public class Titan {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package io.avaje.http.generator.client.clients;
2+
3+
import io.avaje.http.api.Client;
4+
import io.avaje.http.api.Get;
5+
6+
@Client
7+
public interface TitanFall {
8+
9+
@Get("/${titan}/${drop.point}")
10+
Titan titanfall();
11+
}

0 commit comments

Comments
 (0)