Skip to content

the body of patch request is empty #103

Description

@miladz68

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions