Skip to content

don't send entity when get/delete have no body#116

Merged
kares merged 1 commit intocheald:masterfrom
jsvd:dont_use_entity_without_body
Jun 13, 2025
Merged

don't send entity when get/delete have no body#116
kares merged 1 commit intocheald:masterfrom
jsvd:dont_use_entity_without_body

Conversation

@jsvd
Copy link
Copy Markdown
Contributor

@jsvd jsvd commented Mar 27, 2025

Currently a non-body get/delete will sent a "Content-Length: 0" header given the httpclient is passed a request object with Entity.

While RFC 7230 does allow for non-body requests to have "Content-Length: 0" it is marked as a SHOULD NOT and can cause problems in stricter environments.

This commit changes that, where a no body request will use non-entity objects.

fixes logstash-plugins/logstash-input-http_poller#150

Currently a non-body get/delete will sent a "Content-Length: 0"
header given the httpclient is passed a request object with Entity.

While RFC 7230 does allow for non-body requests to have
"Content-Length: 0" it is marked as a SHOULD NOT and can cause problems
in stricter environments.

This commit changes that, where a no body request will use non-entity
objects.
@jsvd
Copy link
Copy Markdown
Contributor Author

jsvd commented May 30, 2025

@cheald 👋 any chance we could get this one in? I also created a PR to move testing to Github Actions - #115 - since travis ci ran out of free credits.

@kares kares merged commit 68a479d into cheald:master Jun 13, 2025
@jsvd
Copy link
Copy Markdown
Contributor Author

jsvd commented Jun 13, 2025

Thanks @kares!

@atoddjh atoddjh mentioned this pull request Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Header with Content-Lenght: 0 is sent even for GET requests with no body

2 participants