handy_http_handlers.path_handler

Defines a path-matching request handler, that will match incoming requests against a set of mappings based on the URL and HTTP method, and call a handler depending on what's matched.

Members

Classes

PathHandler
class PathHandler

A request handler that maps incoming requests to a particular handler based on the request's URL path and/or HTTP method (GET, POST, etc.).

PathHandlerContextData
class PathHandlerContextData

Context data that may be attached to a request to provide additional data from path matching results, like any path variables that were found.

Functions

getMethodBit
ushort getMethodBit(string method)

Maps each HTTP method to a bit value, so we can use bit-masking for handler mappings.

getPathParamAs
T getPathParamAs(ServerHttpRequest request, string name, T defaultValue)

Gets a specific path variable's value.

getPathParams
immutable(PathParam[]) getPathParams(ServerHttpRequest request)

Gets the set of path variables that were matched when the given request was handled by the path handler.

methodMaskFromAll
ushort methodMaskFromAll()

Gets a bitmask that matches all HTTP methods.

methodMaskFromMethods
ushort methodMaskFromMethods(HttpMethod[] methods)

Computes a bitmask from a list of HTTP methods.

Structs

DeleteMapping
struct DeleteMapping

A simplified version of PathMapping for HTTP DELETE mappings only.

GetMapping
struct GetMapping

A simplified version of PathMapping for HTTP GET mappings only.

PatchMapping
struct PatchMapping

A simplified version of PathMapping for HTTP PATCH mappings only.

PathMapping
struct PathMapping

A user-defined attribute that, when added to a function, allows that function to be registered automatically by a path handler when you call its registerHandlers method on the module containing the function.

PostMapping
struct PostMapping

A simplified version of PathMapping for HTTP POST mappings only.

PutMapping
struct PutMapping

A simplified version of PathMapping for HTTP PUT mappings only.