Fix MockHttpServletRequest.setCookies to produce single cookie header
Prior to this commit, MockHttpServletRequest.setCookies() produced one Cookie header per supplied cookie, resulting in multiple Cookie headers which violates the specification. This commit fixes this by ensuring that all cookie name-value pairs are stored under a single Cookie header, separated by a semicolon. Closes gh-23074
This commit is contained in:
committed by
Sam Brannen
parent
22a3364173
commit
5990548f6f
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -259,7 +259,9 @@ public class MockHttpServletRequestTests {
|
||||
assertEquals("bar", cookies[0].getValue());
|
||||
assertEquals("baz", cookies[1].getName());
|
||||
assertEquals("qux", cookies[1].getValue());
|
||||
assertEquals(Arrays.asList("foo=bar", "baz=qux"), cookieHeaders);
|
||||
|
||||
assertEquals(1, cookieHeaders.size());
|
||||
assertEquals("foo=bar; baz=qux", cookieHeaders.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user