Skip to content

MockWebResponseBuilder can't handle null domain in cookie [SPR-14169] #18741

@spring-projects-issues

Description

@spring-projects-issues

Christopher Smith opened SPR-14169 and commented

This is a regression from 4.2, and any tests that set a cookie without explicitly setting the domain will fail when the setting request is made.

As part of the resolution for #18623, MockWebResponseBuilder was retrofitted in f5a5a81 to send the cookie on a round trip through HtmlUnit's Cookie class. The constructor for Cookie throws an exception if the cookie's domain is not set, as is rather typical with custom cookies and is acceptable per RFC 6265 5.3.

This seems to be a bug in HtmlUnit, but the Spring implementation should, if it's going to use the HtmlUnit algorithm as a utility, ensure that the domain is set to the domain of the request (e.g., localhost) if not otherwise specified in the javax.servlet.http.Cookie.


Affects: 4.3 RC1

Issue Links:

Referenced from: pull request #1044

Metadata

Metadata

Assignees

Labels

in: testIssues in the test modulein: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions