Description
David Goblirsch opened SPR-15261 and commented
In response to HEAD, now handled by Spring for @GetMapping
methods as of 4.3+, the HTTP spec says that it "should" include the same headers that GET would include, except that four header parameters are considered "optional". Content-Length is one of these optional headers for HEAD requests. BUT when it is included, it is supposed to have the same value as it would have been for GET, i.e., the length of the response body. My @RestController
@GetMapping
methods return the correct non-zero value for GET requests but are setting Content-Length: 0 for HEAD requests.
This is using Spring 4.3.6 on both JBoss 6.1 (yes, very old) and WildFly 10.1.
Affects: 4.3.6
Reference URL: http://stackoverflow.com/questions/27868314/avoiding-content-length-in-head-response
Issue Links:
- HTTP Response should not contain both Transfer-Encoding and Content-Length headers [SPR-15212] #19776 HTTP Response should not contain both Transfer-Encoding and Content-Length headers