in order to test this, I set up a snap server which echoes the request body. I run the following code and get an empty body, when the request method is PATCH, which means that the request body which was sent to snap server was empty (due to being a newbie I don't know how to test it within http-streams itself and I dispatch it to snap and get the body back :D ). the body is not empty in case of a PUT or POST request.
test2 :: OutReq.Method -> IO ()
test2 meth = do
c <- connectNoSSL
let body = Streams.write (Just ((byteString.toStrict) "requsting ... "))
let q = buildRequest1 $ do
http meth "api/server/echo"
setContentType "application/json"
setAccept "application/json/html"
sendRequest c q body
(resp,respBody) <- receiveResponse c (\p i -> do
xm <- Streams.read i
let bod = fromMaybe "" xm
return (p,bod)
)
closeConnection c
print respBody
I also check it on snap's side, the request body is empty.
This happens with DELETE and OPTIONS method also. I check postman (I take it to be standard), these methods all can have request bodies.
in order to test this, I set up a snap server which echoes the request body. I run the following code and get an empty body, when the request method is PATCH, which means that the request body which was sent to snap server was empty (due to being a newbie I don't know how to test it within http-streams itself and I dispatch it to snap and get the body back :D ). the body is not empty in case of a PUT or POST request.
I also check it on snap's side, the request body is empty.
This happens with DELETE and OPTIONS method also. I check postman (I take it to be standard), these methods all can have request bodies.