Skip to content

Add support in MockRestServiceServer to assert ALL header and queryParam values with a single Matcher #28660

@mspiess

Description

@mspiess

Affects: 5.3.21


The current API for MockRestServiceServer and MockRestRequestMatchers does not allow a test to validate that all values of a certain header key satisfy a matcher. Trying to do

.andExpect(header("Accept", endsWith("json")))

does not work because it passes if the first value for the header ends with "json". I would like to be able to do something like this:

.andExpect(header("Accept", allMatch(endsWith("json"))))

or something to that effect.

Metadata

Metadata

Assignees

Labels

in: testIssues in the test modulein: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchesstatus: supersededAn issue that has been superseded by anothertype: enhancementA general enhancement

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