-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Labels
Milestone
Description
Michael Bell opened SPR-17321 and commented
In brief, the MockServletRequest
and MockServletResponse
cannot handle a cookie of name=value
. They require name=value; (optionalattribute)
. Without the semi-colon, MockCookie.parse()
, introduced in Spring 5.1 RC2 throws an ArrayIndexOutOfBoundsException
.
@Test(expected = ArrayIndexOutOfBoundsException.class)
public void springTestParsingBug() {
// Demonstrates Spring can't handle this
MockCookie.parse("a=1");
}
@Test
public void springTestParsingBugWorkaround() {
// Demonstrates Spring test needs an attribute
MockCookie.parse("a=1; HttpOnly");
}
@Test
public void springTestParsingBugWorkaround2() {
// Demonstrates Spring test needs an attribute
MockCookie.parse("a=1;");
}
Regression was introduced in the work discussed in #21647.
Affects: 5.1 GA
Issue Links:
- Add support for adding cookies as headers in MockHttpServletResponse [SPR-17110] #21647 Add support for adding cookies as headers in MockHttpServletResponse