Skip to content

Add queryParam method to MockHttpServletRequestBuilder #23296

@OrangeDog

Description

@OrangeDog

ServletUriComponentsBuilder uses HttpServletRequest#getQueryString to build on the current request.
However, in a GET or HEAD request, MockHttpServletRequestBuilder#param only adds to the combined parameter map and not the query string, causing it to fail.

The workaround is to provide the parameters directly in the URI string, but this is inferior to the fluent API. The different behaviour is probably surprising to many users.

See also spring-projects/spring-restdocs#26

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: testIssues in the test modulein: webIssues in web modules (web, webmvc, webflux, websocket)status: supersededAn issue that has been superseded by another

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions