Skip to content

org.springframework.test.web.servlet.assertj.AbstractHttpServletResponseAssert#headers case sensitivity #36349

@zeldigas

Description

@zeldigas

In process of adopting MockMvcTester for controller testing I found that

assertThat(mockMvcTester.get("/....")...).headers().hasValue("cache-control", "public") //fails!
assertThat(mockMvcTester.get("/....")...).matches(MockMvcResultMatchers.header().string("cache-control", "public")); //passes!

Code inspection shows that HeaderResultMatchers works in case sensitive mode and it differs from MockMvcResultMatchers behavior.

Personally I think it is a bug as headers are considered case insensitve by semantics, but at minimum it should be documented if you consider it as a feature

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions