feign
feign copied to clipboard
Default Client does not include Content-Length header for POST with Empty Body
We are using Feign 10.7.4 to execute a POST request with an empty body. In this case Feign does not add a Content-Length header to the request. According to the HTTP specification this is fine but some proxies, in our case Azure API Management, do not accept POST request with no Content-Length header. Would it be possible to add a Content-Length: 0
header to PATCH, POST and PUT requests with an empty body?
Further context:
- https://stackoverflow.com/a/4198969
- https://github.com/request/request/issues/89
- https://github.com/urllib3/urllib3/issues/555
- https://github.com/gatling/gatling/issues/3648
Should be a simple change around this https://github.com/OpenFeign/feign/blob/master/core/src/main/java/feign/Client.java#L189
What client are you using? Default one? if so, i gave you the correct link.
We are including spring-cloud-openfeign so I suppose we use the FeignBlockingLoadBalancerClient client class.
@brennerm can you please confirm with the Spring Cloud team that they are passing this through to us first?
In this case, only the default Client
implementation is out of compliance. I'm going to update the title of this issue to reference that class and mark this as a bug.
Is there any workaround for this??
@kdavisk6 still need help for this?
I had the same problem, and solved sending an empty string.
If you are using POST/PUT method with RequestParam, instead of this, try using Request body, cause with empty body Feign Client will send Content-Length: 0, and you will face "Length Required" problem
Have the same problem
Also having this issue. Any idea on an ETA of a fix?
hi @tcolombo08 feign is mainly driven by volunteer work. ETA depends on someone that is affected by this issue getting involved.