Skip to content

Commit 4b89c88

Browse files
author
VerKWer
committed
WIP
1 parent 1de9b80 commit 4b89c88

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

webclient/api/src/main/java/io/helidon/webclient/api/ClientUri.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,28 @@ public ClientUri skipUriEncoding(boolean skipUriEncoding) {
171171
}
172172

173173
/**
174-
* Resolve the provided URI against this URI.
174+
* Replace {@code this} {@link ClientUri}'s URI with the result of resolving the provided {@link URI} against the
175+
* current one.
175176
*
176177
* @param uri URI to use
177-
* @return updated instance
178+
* @return {@code this} updated instance
178179
*/
179180
public ClientUri resolve(URI uri) {
181+
return resolve(uri, false);
182+
}
183+
184+
/**
185+
* Resolve the provided {@link URI} against {@code this} {@link ClientUri}.
186+
*
187+
* @param uri
188+
* @param keepQueryParameters
189+
* @return {@code this} updated instance
190+
*/
191+
public ClientUri resolve(URI uri, boolean keepQueryParameters) {
180192
if (uri.isAbsolute()) {
181193
this.uriBuilder = UriInfo.builder();
182-
this.query.clear();
194+
if(!keepQueryParameters)
195+
this.query.clear();
183196
}
184197

185198
if (uri.getScheme() != null) {

webclient/api/src/test/java/io/helidon/webclient/api/ClientUriTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,10 @@ void testResolveQueryParameter() {
143143
assertThat(helper.scheme(), is("https"));
144144
assertThat(helper.query().get("k"), is("v"));
145145
}
146+
147+
@Test
148+
void myTest() throws Exception {
149+
ClientUri helper = ClientUri.create(URI.create("http://localhost:8080/?k=v"));
150+
System.out.println(helper.resolve(URI.create("?a=b")));
151+
}
146152
}

0 commit comments

Comments
 (0)