-
Couldn't load subscription status.
- Fork 38.8k
Closed
Labels
in: testIssues in the test moduleIssues in the test modulein: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply
Description
Chris Beams opened SPR-13166 and commented
Scenario
An HTTP response contains multiple Set-Cookie headers, e.g.:
$ http head localhost:8080
HTTP/1.1 200 OK
[...]
Set-Cookie: JSESSIONID=58FA8366CB58657E4AD0AE50809D63CB; Path=/; HttpOnly
Set-Cookie: XSRF-TOKEN=27d3cc6d-6d9f-4b50-9d3c-adb67e41639e; Path=/
Problem
Spring MVC Test only stores the last cookie seen:
http.perform(get("/"))
.andDo(print())
.andExpect(status().isOk())
.andExpect(cookie().exists("XSRF-TOKEN")) // PASS
.andExpect(cookie().exists("JSESSIONID")) // FAIL
;The output from the print() above tells the tale:
MockHttpServletResponse:
Status = 200
Error message = null
Headers = {...}
Content type = null
Body =
Forwarded URL = index.html
Redirected URL = null
Cookies = [javax.servlet.http.Cookie@3ccd3277]
Note that the Cookies array contains only a single entry, where it should have two. (and it would be nice by the way, if the cookie entries themselves were rendered in a friendlier way).
Affects: 4.2 RC1
Issue Links:
- Improve documentation on limitations of Spring MVC Test [SPR-13169] #17760 Improve documentation on limitations of Spring MVC Test
- Print cookies in human-readable form in Spring MVC Test [SPR-13168] #17759 Print cookies in human-readable form in Spring MVC Test
Metadata
Metadata
Assignees
Labels
in: testIssues in the test moduleIssues in the test modulein: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply