Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
albertoshiroma opened this issue Mar 11, 2025 · 2 comments
Closed

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

albertoshiroma opened this issue Mar 11, 2025 · 2 comments
Assignees
Labels
in: test Issues in the test module type: regression A bug that is also a regression
Milestone

Comments

@albertoshiroma
Copy link

albertoshiroma commented Mar 11, 2025

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)
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 11, 2025
@sbrannen sbrannen added the in: test Issues in the test module label Mar 12, 2025
@sbrannen sbrannen self-assigned this Mar 12, 2025
@sbrannen
Copy link
Member

sbrannen commented Mar 12, 2025

Hi @albertoshiroma,

Congratulations on submitting your first issue for the Spring Framework! 👍

This is a regression that was introduced in conjunction with:

We'll look into it.

@sbrannen sbrannen added type: regression A bug that is also a regression and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Mar 12, 2025
@sbrannen sbrannen added this to the 6.2.4 milestone Mar 12, 2025
@sbrannen sbrannen changed the title MockCookie.parse() fails to parse "Version" attribute MockCookie.parse() fails to parse custom attribute with a value Mar 12, 2025
@sbrannen
Copy link
Member

This has been fixed in 6.2.x and will be available in the upcoming 6.2.4 release.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
in: test Issues in the test module type: regression A bug that is also a regression
Projects
None yet
Development

No branches or pull requests

3 participants