Skip to content

Conversation

@alex-cova
Copy link
Contributor

In Spring 4, HttpHeaders no longer implements the Map interface, which makes the comparison in RequestHeaderParameterProcessor invalid. This PR addresses this issue.

MethodMetadata data = context.getMethodMetadata();

if (Map.class.isAssignableFrom(parameterType)) {
if (Map.class.isAssignableFrom(parameterType) || HttpHeaders.class.isAssignableFrom(parameterType)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we then need the Map.class.isAssignableFrom(parameterType) check here anymore then since from this point forward we are only compatible with Spring Boot 4 so no need for backward compatibility

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Map.class.isAssignableFrom(parameterType) check is necessary for backward compatibility and to support MultiValueMap usage.

SpringMvcContractTests.java#L635

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we don't need to support Boot versions prior to 4.0.x on the main branch, the 4.3.x branch and the 4.2.x branches of Spring Cloud OpenFeign will support the prior Boot versions. That is why I think we can remove the check for Map.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think it’s safe to remove the check, I’m open to it. That said, I’d prefer to keep it — a lot of tests fail when it’s removed, and users may (or probably) rely on MultiValueMap as a workaround instead of HttpHeaders. Keeping it feels like the safer option to avoid subtle breakages. What do you think?

@ryanjbaxter
Copy link
Contributor

Please sign your commit(s) so the DCO check passes as well

Signed-off-by: Alex <invokevirtual@icloud.com>
@ryanjbaxter ryanjbaxter added this to the 5.0.1 milestone Dec 10, 2025
@ryanjbaxter ryanjbaxter merged commit 8067e1d into spring-cloud:main Dec 10, 2025
2 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in 2025.1.1 Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working in progress

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants