-
Notifications
You must be signed in to change notification settings - Fork 38.4k
RestTemplate headers not sent when bufferRequestBody is false [SPR-8809] #13451
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
Comments
Arjen Poutsma commented This should be fixed now, can you please try a recent (as of tonight) snapshot and try again? Thanks, Arjen |
Ryan Fong commented I downloaded org.springframework.web-3.1.0.CI-1162.jar and replaced only that file in my project but did not see any change in behavior. Do I need to change any other jars? I'd also like to provide you with a test case of some sort but I'm not sure what the best structure is in this case. Please advise. Thanks. |
Ryan Fong commented Apparently I did not grab the right file. The file I tested was dated 30 Jul 2011 (from http://static.springsource.org/downloads/nightly/snapshot-download.php?project=SPR) although this is the nightly link from the Spring Downloads webpage. Where is the correct non-Maven nightly snapshot download location? |
Ryan Fong commented I located the correct build (1294) via the builds tab and tried it. I ran into the exception below. I reviewed the test you wrote and the interceptor has the same statement structure as my own. This problem occurs whether I use the InterceptingClientHttpRequestFactory or the RestTemplate.interceptors property. Exception in thread "main" org.springframework.web.client.ResourceAccessException: I/O error: cannot write to a URLConne |
Arjen Poutsma commented Ok, thanks for the feedback. I will investigate further. |
Arjen Poutsma commented Ok, I made some more changes, and I think it's fixed now. Can you try a recent snapshot (as of tomorrow) again to see if it works for you? |
Ryan Fong commented G'day, Arjen. I confirmed that the header is now sent without buffering via an InterceptingClientHttpRequestFactory as of build CI-1303. Thank you! |
Arjen Poutsma commented Great! Thanks for helping out. |
Ryan Fong opened SPR-8809 and commented
I'm using Spring Core 3.1.0.RC1 on Sun Java 6 with Tomcat 7.0.14. I'm trying to send custom http headers when invoking RestTemplate methods using features in #10535 & #12152.
I configured an InterceptingClientHttpRequestFactory to use an interceptor that adds a header prior to execution. However, I've discovered that my header is not sent when the SimpleClientHttpRequestFactory bufferRequestBody property is false. I've also tried adding the header by setting an interceptor directly on the RestTemplate instead of via request factory but with the same result.
I've only been able to send the custom header by setting the SimpleClientHttpRequestFactory bufferRequestBody property back to its default of true. I need to avoid buffering due to bug #12564. Is this expected behavior? Are any workarounds available? Thank you!
references:
#10535 = RestTemplate - access to Request Headers
#12152 = Introduce interceptors for RestTemplate
#12564 = Sending large payloads with RestTemplate results in an OutOfMemoryError
Affects: 3.1 RC1
Reference URL: http://forum.springsource.org/showthread.php?115876-3.1-RestTemplate-headers-not-sent-when-bufferRequestBody-is-false
Referenced from: commits 53cb529, 91c14bd
The text was updated successfully, but these errors were encountered: