Hoogle Search
Within LTS Haskell 24.67 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
snap-core Snap.Internal.Http.Types No documentation available.
setContentType :: forall (m :: Type -> Type) . Monad m => ByteString -> RequestBuilder m ()snap-core Snap.Test Sets the request's content-type to the given MIME type. Example:
ghci> :set -XOverloadedStrings ghci> import qualified Data.Map as M ghci> buildRequest $ put "/foo/bar" "text/html" "some text" >> setContentType "text/plain" PUT /foo/bar HTTP/1.1 content-type: text/plain content-length: 9 host: localhost sn="localhost" c=127.0.0.1:60000 s=127.0.0.1:8080 ctx=/ clen=9
-
snap-core Snap.Test Sets the given header in the request being built, overwriting any header with the same name already present. Example:
ghci> :set -XOverloadedStrings ghci> import qualified Data.Map as M ghci> :{ ghci| buildRequest $ do get "/foo/bar" M.empty ghci| setHeader "Accept" "text/html" ghci| setHeader "Accept" "text/plain" ghci| :} GET /foo/bar HTTP/1.1 accept: text/plain host: localhost sn="localhost" c=127.0.0.1:60000 s=127.0.0.1:8080 ctx=/ clen=n/a
setHttpVersion :: forall (m :: Type -> Type) . Monad m => (Int, Int) -> RequestBuilder m ()snap-core Snap.Test Sets the test request's http version Example:
ghci> :set -XOverloadedStrings ghci> import qualified Data.Map as M ghci> buildRequest $ delete "/foo/bar" M.empty >> setHttpVersion (1,0) DELETE /foo/bar HTTP/1.0 host: localhost sn="localhost" c=127.0.0.1:60000 s=127.0.0.1:8080 ctx=/ clen=n/a
setQueryString :: forall (m :: Type -> Type) . Monad m => Params -> RequestBuilder m ()snap-core Snap.Test Escapes the given parameter mapping and sets it as the request's query string. Example:
ghci> :set -XOverloadedStrings ghci> import qualified Data.Map as M ghci> buildRequest $ get "/foo/bar" M.empty >> setQueryString (M.fromList [("param0", ["baz"]), ("param1", ["qux"])]) GET /foo/bar?param0=baz¶m1=qux HTTP/1.1 host: localhost sn="localhost" c=127.0.0.1:60000 s=127.0.0.1:8080 ctx=/ clen=n/a params: param0: ["baz"], param1: ["qux"]
setQueryStringRaw :: forall (m :: Type -> Type) . Monad m => ByteString -> RequestBuilder m ()snap-core Snap.Test Sets the request's query string to be the raw bytestring provided, without any escaping or other interpretation. Most users should instead choose the setQueryString function, which takes a parameter mapping. Example:
ghci> :set -XOverloadedStrings ghci> import qualified Data.Map as M ghci> buildRequest $ get "/foo/bar" M.empty >> setQueryStringRaw "param0=baz¶m1=qux" GET /foo/bar?param0=baz¶m1=qux HTTP/1.1 host: localhost sn="localhost" c=127.0.0.1:60000 s=127.0.0.1:8080 ctx=/ clen=n/a params: param0: ["baz"], param1: ["qux"]
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
setSecure :: forall (m :: Type -> Type) . Monad m => Bool -> RequestBuilder m ()snap-core Snap.Test Controls whether the test request being generated appears to be an https request or not. Example:
ghci> :set -XOverloadedStrings ghci> import qualified Data.Map as M ghci> buildRequest $ delete "/foo/bar" M.empty >> setSecure True DELETE /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 secure
setMaximumFileSize :: Int64 -> FileUploadPolicy -> FileUploadPolicysnap-core Snap.Util.FileUploads Maximum size of single uploaded file.