Hoogle Search

Within LTS Haskell 24.46 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. setHeader :: HasHeaders a => CI ByteString -> ByteString -> a -> a

    snap-core Snap.Internal.Http.Types

    Sets a header key-value-pair in a HasHeaders datatype. If a header with the same name already exists, it is overwritten with the new value. Example:

    ghci> import qualified Snap.Types.Headers as H
    ghci> setHeader "Host" "localhost" H.empty
    H {unH = [("host","localhost")]}
    ghci> setHeader "Host" "127.0.0.1" it
    H {unH = [("host","127.0.0.1")]}
    

  2. setResponseBody :: (OutputStream Builder -> IO (OutputStream Builder)) -> Response -> Response

    snap-core Snap.Internal.Http.Types

    Sets an HTTP response body to the given stream procedure. Example:

    ghci> :set -XOverloadedStrings
    ghci> import qualified System.IO.Streams as Streams
    ghci> import qualified Data.ByteString.Builder as Builder
    ghci> :{
    ghci| let r = setResponseBody
    ghci|         (out -> do
    ghci|             Streams.write (Just $ Builder.byteString "Hello, world!") out
    ghci|             return out)
    ghci|         emptyResponse
    ghci| :}
    ghci> r
    HTTP/1.1 200 OK
    
    Hello, world!
    

  3. setResponseCode :: Int -> Response -> Response

    snap-core Snap.Internal.Http.Types

    Sets the HTTP response code. Example:

    ghci> setResponseCode 404 emptyResponse
    HTTP/1.1 404 Not Found
    

  4. setResponseStatus :: Int -> ByteString -> Response -> Response

    snap-core Snap.Internal.Http.Types

    Sets the HTTP response status. Note: normally you would use setResponseCode unless you needed a custom response explanation. Example:

    ghci> :set -XOverloadedStrings
    ghci> setResponseStatus 500 "Internal Server Error" emptyResponse
    HTTP/1.1 500 Internal Server Error
    

  5. set_c_locale :: IO ()

    snap-core Snap.Internal.Http.Types

    No documentation available.

  6. 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
    

  7. setHeader :: forall (m :: Type -> Type) . Monad m => CI ByteString -> ByteString -> RequestBuilder m ()

    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
    

  8. 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
    

  9. 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&param1=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"]
    

  10. 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&param1=qux"
    GET /foo/bar?param0=baz&param1=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"]
    

Page 303 of many | Previous | Next