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.

  1. setMaxLengthForRequest :: (Request -> IO (Maybe Word64)) -> RequestSizeLimitSettings -> RequestSizeLimitSettings

    wai-extra Network.Wai.Middleware.RequestSizeLimit

    Function to determine the maximum request size in bytes for the request. Return Nothing for no limit.

  2. data RequestSizeLimitSettings

    wai-extra Network.Wai.Middleware.RequestSizeLimit.Internal

    Settings to configure requestSizeLimitMiddleware. This type (but not the constructor, or record fields) is exported from Network.Wai.Middleware.RequestSizeLimit. Since the constructor isn't exported, create a default value with defaultRequestSizeLimitSettings first, then set the values using setMaxLengthForRequest and setOnLengthExceeded (See the examples below). If you need to access the constructor directly, it's exported from Network.Wai.Middleware.RequestSizeLimit.Internal.

    Examples

    Conditionally setting the limit based on the request
    {-# LANGUAGE OverloadedStrings #-}
    import Network.Wai
    import Network.Wai.Middleware.RequestSizeLimit
    
    let megabyte = 1024 * 1024
    let sizeForReq req = if pathInfo req == ["upload", "image"] then pure $ Just $ megabyte * 20 else pure $ Just $ megabyte * 2
    let finalSettings = setMaxLengthForRequest sizeForReq defaultRequestSizeLimitSettings
    
    JSON response
    {-# LANGUAGE OverloadedStrings #-}
    import Network.Wai
    import Network.Wai.Middleware.RequestSizeLimit
    import Network.HTTP.Types.Status (requestEntityTooLarge413)
    import Data.Aeson
    import Data.Text (Text)
    
    let jsonResponse = \_maxLen _app _req sendResponse -> sendResponse $ responseLBS requestEntityTooLarge413 [("Content-Type", "application/json")] (encode $ object ["error" .= ("request size too large" :: Text)])
    let finalSettings = setOnLengthExceeded jsonResponse defaultRequestSizeLimitSettings
    

  3. RequestSizeLimitSettings :: (Request -> IO (Maybe Word64)) -> (Word64 -> Middleware) -> RequestSizeLimitSettings

    wai-extra Network.Wai.Middleware.RequestSizeLimit.Internal

    No documentation available.

  4. maxLengthForRequest :: RequestSizeLimitSettings -> Request -> IO (Maybe Word64)

    wai-extra Network.Wai.Middleware.RequestSizeLimit.Internal

    Function to determine the maximum request size in bytes for the request. Return Nothing for no limit. Since 3.1.1

  5. setMaxLengthForRequest :: (Request -> IO (Maybe Word64)) -> RequestSizeLimitSettings -> RequestSizeLimitSettings

    wai-extra Network.Wai.Middleware.RequestSizeLimit.Internal

    Function to determine the maximum request size in bytes for the request. Return Nothing for no limit.

  6. rewriteRequest :: (PathsAndQueries -> RequestHeaders -> IO PathsAndQueries) -> Request -> IO Request

    wai-extra Network.Wai.Middleware.Rewrite

    Modify a Request using the supplied function in IO. This is suitable for the reverse proxy example.

  7. rewriteRequestPure :: (PathsAndQueries -> RequestHeaders -> PathsAndQueries) -> Request -> Request

    wai-extra Network.Wai.Middleware.Rewrite

    Modify a Request using the pure supplied function. This is suitable for the reverse proxy example.

  8. data ParseRequestBodyOptions

    wai-extra Network.Wai.Parse

    A data structure that describes the behavior of the parseRequestBodyEx function.

  9. data RequestBodyType

    wai-extra Network.Wai.Parse

    The mimetype of the http body. Depending on whether just parameters or parameters and files are passed, one or the other mimetype should be used.

  10. data RequestParseException

    wai-extra Network.Wai.Parse

    Things that could go wrong while parsing a Request

Page 235 of many | Previous | Next