graph LR
Request_Handler_Orchestrator["Request Handler Orchestrator"]
Request["Request"]
Router["Router"]
Request_Dispatcher["Request Dispatcher"]
Handler_Invoker["Handler Invoker"]
Multipart_Form_Data_Parser["Multipart Form Data Parser"]
Middleware_Hook_Manager["Middleware/Hook Manager"]
Error_Handler["Error Handler"]
Request_Handler_Orchestrator -- "creates" --> Request
Request_Handler_Orchestrator -- "passes control to" --> Request_Dispatcher
Request -- "interacts with" --> Multipart_Form_Data_Parser
Request_Dispatcher -- "consults" --> Router
Request_Dispatcher -- "retrieves hooks from" --> Middleware_Hook_Manager
Request_Dispatcher -- "utilizes" --> Handler_Invoker
Request_Dispatcher -- "delegates to" --> Error_Handler
The Request Processing & Routing subsystem in Microdot is responsible for the entire lifecycle of an incoming HTTP request, from its initial reception to the invocation of the appropriate handler and the generation of a response. This includes parsing the raw HTTP request, identifying the target URL, matching it to a registered route, applying any relevant middleware or hooks, executing the designated handler function, and managing errors that may occur during this process.
The primary entry point for processing an individual HTTP connection. It manages the initial reception of an HTTP request, creates a Request object, and delegates the core processing to the Request Dispatcher.
Related Classes/Methods:
Encapsulates all incoming HTTP request details. It stores and provides access to all components of an incoming HTTP request, including headers, method, URL, and body content. It also handles the parsing of various content types.
Related Classes/Methods:
microdot.Request:288-530microdot.Request:formmicrodot.Request:_parse_urlencodedmicrodot.Request:body
Defines and matches URL patterns to specific handler functions. It manages the application's routing table, allowing the registration of URL patterns and their associated handler functions. It provides mechanisms to find a matching route for a given request path and method.
Related Classes/Methods:
The core routing engine that finds the appropriate handler, applies middleware-like functions (hooks), and invokes the matched handler. It acts as the central orchestrator of the request processing pipeline.
Related Classes/Methods:
Executes the Python function (view function) associated with a matched route. It is responsible for calling the application-defined function that has been matched to the incoming request by the Router and Request Dispatcher.
Related Classes/Methods:
Specifically handles parsing and iterating over multipart/form-data request bodies. It provides specialized parsing capabilities for this encoding, allowing efficient iteration over form fields and files.
Related Classes/Methods:
Manages and retrieves before_request and after_request handlers, as well as error handlers. It provides access to global and route-specific functions that can modify the request or response, or handle errors.
Related Classes/Methods:
Generates appropriate HTTP error responses for exceptions that occur during request processing. It catches exceptions and maps them to standard HTTP error codes (e.g., 404 Not Found, 500 Internal Server Error).
Related Classes/Methods: