-
Notifications
You must be signed in to change notification settings - Fork 37.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ContentCachingResponseWrapper should not add “Content-Length” when “Transfer-Encoding” is present #26182
Comments
We can improve this to ensure |
By the way you should try and be on at least the latest 4.3.x release which at this point is 4.3.29. I'm wondering also if you have any plans to upgrade to a 5.x release? I think this is reasonably safe to backport but nevertheless I'd rather minimize any potential for unintended impact. |
Hi @rstoyanchev , |
I'll backport to 4.3.x but the fix depends on the ability to get a header from the response which will work only in a Servlet 3+ environment. |
Noted, thanks ! |
Affects: <4.3.21>
I'm using ContentCachingResponseWrapper to read response information in a inherited
OncePerRequestFilter.doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
level.At the end I'm calling ContentCachingResponseWrapper.copyBodyToResponse() to copy response body.
When my API returns ResponseEntity with custom body type, I'm getting following Parse Error;
Parse Error: The response headers can't include "Content-Length" with chunked encoding
This happens when I use Spring Cloud OpenFeign web client to do the API call. So in the OpenFeign GET response includes "transfer-encoding" in the headers and then when I call ContentCachingResponseWrapper.copyBodyToResponse() it is adding "Content-Length" to the headers.
My code is as follows;
OncePerRequestFilter overriden method;
The text was updated successfully, but these errors were encountered: