Hoogle Search
Within LTS Haskell 24.52 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
MultipartPostRequest :: MultipartParams -> RequestTypesnap-core Snap.Test No documentation available.
data
RequestBuilder (m :: Type -> Type) asnap-core Snap.Test RequestBuilder is a monad transformer that allows you to conveniently build a snap Request for testing.
-
snap-core Snap.Test The RequestType datatype enumerates the different kinds of HTTP requests you can generate using the testing interface. Most users will prefer to use the get, postUrlEncoded, postMultipart, put, and delete convenience functions.
RequestWithRawBody :: Method -> ByteString -> RequestTypesnap-core Snap.Test No documentation available.
UrlEncodedPostRequest :: Params -> RequestTypesnap-core Snap.Test No documentation available.
buildRequest :: MonadIO m => RequestBuilder m () -> m Requestsnap-core Snap.Test Runs a RequestBuilder, producing the desired Request. N.B. please don't use the request you get here in a real Snap application; things will probably break. Don't say you weren't warned :-) Example:
ghci> :set -XOverloadedStrings ghci> import qualified Data.Map as M ghci> buildRequest $ get "/foo/bar" M.empty GET /foo/bar HTTP/1.1 host: localhost sn="localhost" c=127.0.0.1:60000 s=127.0.0.1:8080 ctx=/ clen=n/a
requestToString :: Request -> IO ByteStringsnap-core Snap.Test Converts the given Request to a bytestring. Since: 1.0.0.0 Example:
ghci> :set -XOverloadedStrings ghci> import qualified Data.Map as M ghci> r <- buildRequest $ get "/foo/bar" M.empty ghci> requestToString r "GET /foo/bar HTTP/1.1\r\nhost: localhost\r\n\r\n"
setRequestPath :: forall (m :: Type -> Type) . Monad m => ByteString -> RequestBuilder m ()snap-core Snap.Test Sets the request's path. The path provided must begin with a "/" and must not contain a query string; if you want to provide a query string in your test request, you must use setQueryString or setQueryStringRaw. Note that rqContextPath is never set by any RequestBuilder function. Example:
ghci> :set -XOverloadedStrings ghci> import qualified Data.Map as M ghci> buildRequest $ get "/foo/bar" M.empty >> setRequestPath "/bar/foo" GET /bar/foo HTTP/1.1 host: localhost sn="localhost" c=127.0.0.1:60000 s=127.0.0.1:8080 ctx=/ clen=n/a
setRequestType :: forall (m :: Type -> Type) . MonadIO m => RequestType -> RequestBuilder m ()snap-core Snap.Test Sets the type of the Request being built. Example:
ghci> :set -XOverloadedStrings ghci> import qualified Data.Map as M ghci> buildRequest $ delete "/foo/bar" M.empty >> setRequestType GetRequest GET /foo/bar HTTP/1.1 host: localhost sn="localhost" c=127.0.0.1:60000 s=127.0.0.1:8080 ctx=/ clen=n/a
serializeQuery :: URINormalizationOptions -> Query -> Builderuri-bytestring URI.ByteString Serialize the query part of a url serializeQuery opts mempty = "" serializeQuery opts (Query [("a","b"),("c","d")]) = "?a=b&c=d"