on master help sign in
Allow body for DELETE
a920ec0Sridhar Ratnakumar
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+
1## Req 3.3.0
6## Req 3.3.0
2
7
3* Derived `Show` instances for response types `IgnoreResponse`,
8* Derived `Show` instances for response types `IgnoreResponse`,
Network/HTTP/Req.hs+6−5
@@ -770,14 +770,15 @@ instance HttpMethod PUT where
770 type AllowsBody PUT = 'CanHaveBody
770 type AllowsBody PUT = 'CanHaveBody
771 httpMethodName Proxy = Y.methodPut
771 httpMethodName Proxy = Y.methodPut
772
772
773−-- | 'DELETE' method. This data type does not allow having request body with
773+-- | 'DELETE' method. RFC 7231 allows a payload in DELETE but without
774−-- 'DELETE' requests, as it should be. However some APIs may expect 'DELETE'
774+-- semantics.
775−-- requests to have bodies, in that case define your own variation of
775+--
776−-- 'DELETE' method and allow it to have a body.
776+-- __Note__: before version /3.4.0/ this method did not allow request
777+-- bodies.
777data DELETE = DELETE
778data DELETE = DELETE
778
779
779instance HttpMethod DELETE where
780instance HttpMethod DELETE where
780− type AllowsBody DELETE = 'NoBody
781+ type AllowsBody DELETE = 'CanHaveBody
781 httpMethodName Proxy = Y.methodDelete
782 httpMethodName Proxy = Y.methodDelete
782
783
783-- | 'TRACE' method.
784-- | 'TRACE' method.