See #32913 and this prototype work by @snicoll for background.

In the example above, it's quite common to see code like this:

assertThat(this.mvc.get()
            .uri("/actuator/auditevents")
            .param("principal", "alice")
            .param("after", queryTimestamp)
            .param("type", "logout"))
        .hasStatusOk();

Repeating the .param call is quite noisy, and it would be nice if you could do something similar to Map.of(...):

assertThat(this.mvc.get()
            .uri("/actuator/auditevents")
            .params("principal", "alice", "after", queryTimestamp, "type", "logout"))
        .hasStatusOk();

Same with the header call.

Both headers and params are multi-value maps, so it's perhaps not entirely straightforward. Perhaps an instanceof check is also needed to support something like:

.params("h1", List.of("v1, "v2"), "h2", "v3")

Comment From: snicoll

We've discussed this one and we're not sure that the override is worth it, especially considering the use of varargs. Would a Consumer works?

Comment From: philwebb

There's already a with method which I think could be used to add parameters. I think we should just close this one.

Comment From: snicoll

Alright, if we want something a bit more concrete, we could add something like B params(Consumer<MultivalueMap<String,String>> in the future.