Skip to content

Default Client does not include Content-Length header for POST with Empty Body #1229

Closed

Description

@brennerm

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:

Activity

  1. velo commented on May 19, 2020

    @velo
    Member

    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.

  2. brennerm commented on May 20, 2020

    @brennerm
    Author

    We are including spring-cloud-openfeign so I suppose we use the FeignBlockingLoadBalancerClient client class.

  3. kdavisk6 commented on May 30, 2020

    @kdavisk6
    Member

    @brennerm can you please confirm with the Spring Cloud team that they are passing this through to us first?

  4. added
    feedback provided
    on May 30, 2020
  5. kdavisk6 commented on Dec 29, 2020

    @kdavisk6
    Member

    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.

  6. changed the title [-]No Content-Length header for POST request with an empty body[/-] [+]Default Client does not include Content-Length header for POST with Empty Body[/+] on Dec 29, 2020
  7. added
    bug
    help wanted
    and removed
    feedback provided
    on Dec 29, 2020
  8. ameenudheenirshad commented on May 11, 2021

    @ameenudheenirshad

    Is there any workaround for this??

  9. MazizEsa commented on May 29, 2021

    @MazizEsa

    @kdavisk6 still need help for this?

  10. raphmello commented on Aug 16, 2021

    @raphmello

    I had the same problem, and solved sending an empty string.

  11. Yerden01 commented on Nov 1, 2021

    @Yerden01

    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

  12. alexey-plotnikoff commented on Dec 16, 2021

    @alexey-plotnikoff

    Have the same problem

  13. tcolombo08 commented on Jul 11, 2022

    @tcolombo08

    Also having this issue. Any idea on an ETA of a fix?

  14. velo commented on Jul 11, 2022

    @velo
    Member

    hi @tcolombo08 feign is mainly driven by volunteer work. ETA depends on someone that is affected by this issue getting involved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions