Hoogle Search

Within LTS Haskell 24.69 (ghc-9.10.3)

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

  1. defaultRequestLoggerSettings :: RequestLoggerSettings

    wai-extra Network.Wai.Middleware.RequestLogger

    Default RequestLoggerSettings. Use this to create RequestLoggerSettings, and use the accompanying fields to edit these settings.

  2. data RequestSizeLimitSettings

    wai-extra Network.Wai.Middleware.RequestSizeLimit

    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. defaultRequestSizeLimitSettings :: RequestSizeLimitSettings

    wai-extra Network.Wai.Middleware.RequestSizeLimit

    Create a RequestSizeLimitSettings with these settings:

    • 2MB size limit for all requests
    • When the limit is exceeded, return a plain text response describing the error, with a 413 status code.

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

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

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

    No documentation available.

  6. data ValidateHeadersSettings

    wai-extra Network.Wai.Middleware.ValidateHeaders

    Configuration for validateHeadersMiddleware.

  7. ValidateHeadersSettings :: (InvalidHeader -> Middleware) -> ValidateHeadersSettings

    wai-extra Network.Wai.Middleware.ValidateHeaders

    No documentation available.

  8. defaultValidateHeadersSettings :: ValidateHeadersSettings

    wai-extra Network.Wai.Middleware.ValidateHeaders

    Default configuration for validateHeadersMiddleware. Checks that each header meets the requirements listed at the top of this module: Allowed octets for name and value and no trailing whitespace in the value.

  9. module Data.HashSet

    No documentation available.

  10. module Data.IntSet

    No documentation available.

Page 1156 of many | Previous | Next