Spring MVC Test support for expectations on multivalue response headers [SPR-10087] #14720
Labels
in: test
Issues in the test module
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Rick Mann opened SPR-10087 and commented
I'm not sure if the problem lies in the -test-mvc or -webmvc (or both).
In my webapp I build an HTTP response by calling HttpHeaders.add() twice with the same header and two different values. The resulting response on the wire contains this:
Vary: foo
Vary: bar
HTTP/1.1 allows this, but requires that it be possible to combine them into a single header field:
Vary: foo, bar
Unfortunately, the HeaderResultMatcher does not take the possibility of multiple headers into consideration when testing for the presence of a header:
https://github.com/SpringSource/spring-test-mvc/blob/master/src/main/java/org/springframework/test/web/server/result/HeaderResultMatchers.java
Line 49 should call getHeaders() and iterate through all the available results.
Alternatively, if ResponseEntity and HttpHeaders collaborated to combine multiple headers with the same name onto a single line, then a containsString() test would be sufficient to work around this problem.
Affects: 3.2 RC2, 4.2.4
Referenced from: commits 952a317
The text was updated successfully, but these errors were encountered: