feign.httpclient.ApacheHttpClient should not setEntity when request body is null in order to support application/x-www-form-urlencode
See original GitHub issueIn recently, I replaced “com.netflix.feign:feign-httpclient:8.18.0” with “io.github.openfeign:feign-httpclient” along with spring boot application, because which from netflix is deprecated.
I found a difference between two dependencies that one from netflix let entity null on building request, the other from openfeign(this repo.) let entity be an empty byte array.
So, org.apache.http.client.methods.RequestBuilder
comes to finally build a HttpUriRequest
of InternalRequest
skipping making entityCopy be UrlEncodedFormEntity
, even if headers has ‘Content-Type: application/x-www-form-urlencoded’.
So I finally got 400 Bad Request from other spring cloud server.
I think, as a wrapper of apache http client, feign.httpclient should follow apache’s implementation.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
From what I can tell looking into this, the issue lies with our use of the
RequestBuilder
, which explicitly states:Since you appear to be one of a few with this issue, I suspect the issue is in your implementation. Can you please provide a test case the replicates your issue?
I found it has conflict with #510, #511. But after failed to test, dug into the
RequestBuilder
. Test ofwithoutBody
should be done along without@PUT
or@POST
.