Skip to content

WebClient - Uri resolved without query params when path and query params are mixed. #8566

@ashcor

Description

@ashcor

I would expect the resolved uri to be the same in all four examples below. Instead, the query params are missing when path and query params are mixed when building requests.

Environment Details

  • Helidon Version: 4.0.6
  • Helidon SE
  • JDK version: 21
  • OS: Mac OSX
  • Docker version (if applicable):

Problem Description

See tests below. The test fails for test1 and test2. Would expect the same result as for the other two tests.

Steps to reproduce

private final String expected = "https://eu.example.com:443/a/b?q=one";

    @Disabled
    @Test
    void test1() {
        var uri = WebClient.create()
                .get()
                .uri("https://eu.example.com/{path}/b")
                .pathParam("path", "a")
                .queryParam("q", "one")
                .resolvedUri();
         // actual: "https://eu.example.com/a/b"
        assertEquals(expected, uri.toString());
    }

    @Disabled
    @Test
    void test2() {
        var uri = WebClient.create()
                .get()
                .uri("https://{region}.example.com/a/b")
                .pathParam("region", "eu")
                .queryParam("q", "one")
                .resolvedUri();
        // actual: "https://eu.example.com/a/b"
        assertEquals(expected, uri.toString());
    }

    @Test
    void test3() {
        var uri = WebClient.create()
                .get()
                .uri("https://eu.example.com/a/b")
                .queryParam("q", "one")
                .resolvedUri();
        assertEquals(expected, uri.toString());
    }

    @Test
    void test4() {
        var uri = WebClient.create()
                .get()
                .uri("https://{region}.example.com/a/b?q={q}")
                .pathParam("region", "eu")
                .pathParam("q", "one")
                .skipUriEncoding(true)
                .resolvedUri();
        assertEquals(expected, uri.toString());
    }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions