Skip to content

Empty query params shouldn't be filtered out in RequestTemplate #872

@budaimartin

Description

@budaimartin

Background

In #778, there were some modifications in RequestTemplate, affecting query parameter resolution. As a result, empty query parameters are being filtered out. On the other hand, according to RFC 6570, empty query parameters are allowed, but with this change, Feign cannot handle this anymore.

Example

Let's suppose we have this client:

public interface DemoClient {
    @RequestMapping(path = "/test", method = RequestMethod.GET)
    String test(@RequestParam("param") String param);
}

Then the following assertion (using WireMock) is true:

@Test
public void testNonEmptyParam() {
    demoClient.test("asd");
    wireMockServer.verify(getRequestedFor(urlPathEqualTo("/test")).withQueryParam("param", equalTo("asd")));
}

While this is not:

@Test
public void testEmptyParam() {
    demoClient.test("");
    wireMockServer.verify(getRequestedFor(urlPathEqualTo("/test")).withQueryParam("param", equalTo("")));
}

See my respository for full project.

Expected behavior

Empty strings are sent as empty query parameters, such as:

http://localhost:8080/test?param=

Metadata

Metadata

Assignees

No one assigned

    Labels

    regressionBugs and issues related to unintended breaking changesspring-cloudIssues related to Spring Cloud OpenFeign

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions