Skip to content

MockCookie.parse() fails to parse custom attribute with a value #34575

Closed
@albertoshiroma

Description

@albertoshiroma

I was trying to upgrade to spring-test 6.2.x when most of the unit tests got an error parsing "Version" attribute.

Example:

MockCookie.parse("mycookie=mycookie_value; HttpOnly; Version=1");

Results in

java.lang.IllegalArgumentException: Cookie attribute name "Version=1" contains an invalid character for an attribute name
	at jakarta.servlet.http.Cookie.setAttribute(Cookie.java:468)
	at org.springframework.mock.web.MockCookie.setAttribute(MockCookie.java:204)
	at org.springframework.mock.web.MockCookie.parse(MockCookie.java:181)

Metadata

Metadata

Assignees

Labels

in: testIssues in the test moduletype: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions