Skip to content

HttpHeaders.toSingleValueMap() is not case-insensitive #36070

@OrangeDog

Description

@OrangeDog

The map returned by HttpHeaders.toSingleValueMap() is not case-insensitive.

This copy also ensures that collection-iterating methods like entrySet() are case-insensitive.

var response = restTemplate.getForEntity(uri, String.class);
assertTrue(response.getHeaders().containsHeader("date");  // passes
assertTrue(response.getHeaders().containsHeader("Date");  // passes
assertTrue(response.getHeaders().toSingleValueMap().keySet().contains("date");  // passes
assertTrue(response.getHeaders().toSingleValueMap().keySet().contains("Date");  // fails

Which case they're been normalised to depends on the request factory.

Tested with Spring Framework 7.0.2 (via Boot 4.0.1).

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: feedback-providedFeedback has been providedstatus: waiting-for-triageAn issue we've not yet triaged or decided on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions