Skip to content
Discussion options

You must be logged in to vote

Hi @ZhymabekRoman

HTTPX does not disallow sending bodies on any method. We don’t allow it in the shortcut methods, but it is fully allowed with the usage you mentioned, which is not a workaround but the documented and supported way to do so, as per the Requests compatibility guide:

https://www.python-httpx.org/compatibility/#request-body-on-http-methods

If you really do need to send request data using these http methods you should use the generic .request function instead.

httpx.request(
  method="DELETE",
  url="https://www.example.com/",
  content=b'A request body on a DELETE request.'
)

There has been extensive thinking behind this design decision and various discussions already. Pl…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by lovelydinosaur
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2276 on June 23, 2022 07:41.