Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the body of patch request is empty #103

Open
miladz68 opened this issue Feb 12, 2017 · 0 comments
Open

the body of patch request is empty #103

miladz68 opened this issue Feb 12, 2017 · 0 comments

Comments

@miladz68
Copy link

miladz68 commented Feb 12, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant