| Copyright | (c) digitally induced GmbH 2020 |
|---|---|
| Safe Haskell | None |
| Language | GHC2021 |
IHP.Router.Types
Description
Synopsis
- data ControllerRoute application
- = ControllerRouteMap !(HashMap ByteString (application -> Application)) (Parser Application)
- | ControllerRouteParser !(Parser Application)
- | ControllerRouteTrie !RouteTrie
- data TypedAutoRouteError
- = BadType {
- expectedType :: !ByteString
- value :: !(Maybe ByteString)
- field :: !ByteString
- | TooFewArguments
- | NotMatched
- | NoConstructorMatched {
- expectedType :: !ByteString
- value :: !(Maybe ByteString)
- field :: !ByteString
- = BadType {
- data UnexpectedMethodException = UnexpectedMethodException {
- allowedMethods :: [StdMethod]
- method :: StdMethod
- newtype BadHttpMethodException = BadHttpMethodException {
- method :: ByteString
Documentation
data ControllerRoute application Source #
A controller route entry. Three flavours:
ControllerRouteMap— the legacyAutoRoutepath: a pre-built HashMap of full paths to handlers, plus a custom-routes fallbackParser.ControllerRouteParser— standalone customParser(for helpers likeget,post,webSocketApp,startPage, etc.).ControllerRouteTrie— the new explicit-routes path: a pre-built trie fragment carrying method-aware, capture-aware route entries. Used by theroutesquasi-quoter.
frontControllerToWAIApp first merges all ControllerRouteTrie
fragments into a single RouteTrie and tries a fast, method-aware lookup against
it. On no match it falls back to the legacy ControllerRouteMap HashMap scan
and, finally, to Attoparsec for the remaining custom parsers.
Constructors
| ControllerRouteMap !(HashMap ByteString (application -> Application)) (Parser Application) | Auto-route HashMap + custom routes fallback parser (lazy — only evaluated on HashMap miss) |
| ControllerRouteParser !(Parser Application) | Custom route parser (for get, post, webSocketApp, startPage, etc.) |
| ControllerRouteTrie !RouteTrie | Pre-built trie fragment from the |
data TypedAutoRouteError Source #
Constructors
| BadType | |
Fields
| |
| TooFewArguments | |
| NotMatched | |
| NoConstructorMatched | Thrown when Let's say we have a When opening |
Fields
| |
Instances
| Exception TypedAutoRouteError Source # | |
Defined in IHP.Router.Types | |
| Show TypedAutoRouteError Source # | |
Defined in IHP.Router.Types Methods showsPrec :: Int -> TypedAutoRouteError -> ShowS # show :: TypedAutoRouteError -> String # showList :: [TypedAutoRouteError] -> ShowS # | |
data UnexpectedMethodException Source #
Thrown e.g. a CreateProjectAction is called from a GET request
Constructors
| UnexpectedMethodException | |
Fields
| |
Instances
| Exception UnexpectedMethodException Source # | |
Defined in IHP.Router.Types | |
| Show UnexpectedMethodException Source # | |
Defined in IHP.Router.Types Methods showsPrec :: Int -> UnexpectedMethodException -> ShowS # show :: UnexpectedMethodException -> String # showList :: [UnexpectedMethodException] -> ShowS # | |
newtype BadHttpMethodException Source #
Thrown when the request uses an HTTP method that isn't part of the standard set (GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH, CONNECT, TRACE).
For example, a PROPFIND request from a WebDAV scanner. The error handler
middleware translates this into a 400 Bad Request response.
Constructors
| BadHttpMethodException | |
Fields
| |
Instances
| Exception BadHttpMethodException Source # | |
Defined in IHP.Router.Types | |
| Show BadHttpMethodException Source # | |
Defined in IHP.Router.Types Methods showsPrec :: Int -> BadHttpMethodException -> ShowS # show :: BadHttpMethodException -> String # showList :: [BadHttpMethodException] -> ShowS # | |