How do I set the HTTP request body with Wreq?

216 Views Asked by At

How can I set the request body when using customMethod https://hackage.haskell.org/package/wreq-0.5.2.1/docs/Network-Wreq.html#v:customMethod?

post, put etc accept a parameter for the body, however there is no such parameter for customMethod.

1

There are 1 best solutions below

0
On BEST ANSWER

Use customPayloadMethod to specify a custom method on a request with a postable body.

customPayloadMethod :: Postable a => String -> String -> a -> IO (Response ByteString)

There are a few other variations of this depending on your needs:

customPayloadMethodWith :: Postable a => String -> Options -> String -> a -> IO (Response ByteString) Source#
customHistoriedPayloadMethod :: Postable a => String -> String -> a -> IO (HistoriedResponse ByteString) Source#
customHistoriedPayloadMethodWith :: Postable a => String -> Options -> String -> a -> IO (HistoriedResponse ByteString)