on master help sign in
Allow body for DELETE

From the rfc: A payload within a DELETE request message has no defined semantics; sending a payload body on a DELETE request might cause some existing implementations to reject the request. The spec does not forbid it. There are legitimate use cases for passing a body to DELETE request; for example, when deleting a file in a Git repo it is considered safe to pass the blob sha (so you don't end up accidentally deleting an updated file). GitHub API does this: https://developer.github.com/v3/repos/contents/#delete-a-file

commita920ec09cbfc8a24b561f08d1534e34727fcded1 authorSridhar Ratnakumar <srid@srid.ca> dateSat 20 Jun 2020, 21:08 (6 years ago) parent7ebeb9e
2 files changed+11−5
CHANGELOG.md+5 Network/HTTP/Req.hs+6−5
CHANGELOG.md+5
@@ -1,3 +1,8 @@
1+## Req 3.4.0
2+
3+* Requests using `DELETE` method can now have a body. [Issue
4+ 89](https://github.com/mrkkrp/req/issues/89).
5+
16## Req 3.3.0
27
38* Derived `Show` instances for response types `IgnoreResponse`,
Network/HTTP/Req.hs+6−5
@@ -770,14 +770,15 @@ instance HttpMethod PUT where
770770 type AllowsBody PUT = 'CanHaveBody
771771 httpMethodName Proxy = Y.methodPut
772772
773−-- | 'DELETE' method. This data type does not allow having request body with
774−-- 'DELETE' requests, as it should be. However some APIs may expect 'DELETE'
775−-- requests to have bodies, in that case define your own variation of
776−-- 'DELETE' method and allow it to have a body.
773+-- | 'DELETE' method. RFC 7231 allows a payload in DELETE but without
774+-- semantics.
775+--
776+-- __Note__: before version /3.4.0/ this method did not allow request
777+-- bodies.
777778data DELETE = DELETE
778779
779780instance HttpMethod DELETE where
780− type AllowsBody DELETE = 'NoBody
781+ type AllowsBody DELETE = 'CanHaveBody
781782 httpMethodName Proxy = Y.methodDelete
782783
783784-- | 'TRACE' method.