-- | A helper to build a 'Request BSL.ByteString', setting the content length properly in the header
buildRequest :: RequestMethod
             -> URI
             -> BSL.ByteString -- ^ The request body
             -> Request BSL.ByteString
buildRequest method url body =
    setContentLength . setBody $ (mkRequest method url :: Request BSL.ByteString)
  where
    setBody req      = req { rqBody = body }
    setContentLength = replaceHeader HdrContentLength $ show (BSL.length body)
buildRequest :: RequestMethod
             -> URI
             -> BSL.ByteString -- ^ The request body
             -> Request BSL.ByteString
buildRequest method url body =
    setContentLength . setBody $ (mkRequest method url :: Request BSL.ByteString)
  where
    setBody req      = req { rqBody = body }
    setContentLength = replaceHeader HdrContentLength $ show (BSL.length body)
buildRequest method url body =
    setContentLength . setBody $ (mkRequest method url :: Request BSL.ByteString)
  where
    setBody req      = req { rqBody = body }
    setContentLength = replaceHeader HdrContentLength $ show (BSL.length body)