Skip to content

Commit

Permalink
Merge pull request #324 from SentryMan/path
Browse files Browse the repository at this point in the history
[http-client] Reset base if an http scheme is detected
  • Loading branch information
rbygrave authored Oct 19, 2023
2 parents 14f5d74 + c87cddb commit 1ac29fe
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
11 changes: 10 additions & 1 deletion http-client/src/main/java/io/avaje/http/client/DUrlBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,22 @@ final class DUrlBuilder implements UrlBuilder {

@Override
public UrlBuilder url(String url) {
buffer.delete(0, buffer.length());

if (url.startsWith("http") && url.contains("://")) {
buffer.setLength(0);
}

buffer.append(url);
return this;
}

@Override
public UrlBuilder path(String path) {
if (path.startsWith("http") && path.contains("://")) {
buffer.setLength(0);
buffer.append(path);
return this;
}
buffer.append("/").append(path);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package io.avaje.http.generator.client.clients;

public class Titan {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.avaje.http.generator.client.clients;

import io.avaje.http.api.Client;
import io.avaje.http.api.Get;

@Client
public interface TitanFall {

@Get("/${titan}/${drop.point}")
Titan titanfall();
}

0 comments on commit 1ac29fe

Please sign in to comment.