Skip to content

HttpRequestHandlingEndpointSupport throws IllegalStateException when duplicate cookie names are in a request #3641

@Anthonyas007

Description

@Anthonyas007

In what version(s) of Spring Integration are you seeing this issue?

5.2.0.RELEASE and later, NOT in versions 4.x

Describe the bug

When a duplicate cookie name appears in a request, an IllegalStateException is thrown. Previously the last cookie was put in the "evaluationContext" cookies map, and duplicates were ignored. There was an update made to use Java steams instead of a for loop in the HttpRequestHandlingEndpointSupport#prepareEvaluationContext() method, however Collectors.toMap(...) was not used with a merge function, therefore it throws the IllegalStateException when you try to map two keys.

To Reproduce

Send an HTTP request with duplicate cookies

Expected behavior

I expect the request to ignore the duplicates or to throw an exception with a clear and concise message explaining that duplicate cookies are not allowed. Preferably the request would be handled gracefully, like it was in previous versions, and simply use the last cookie in the request.getCookies() array.

Sample

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions