MethodView
Dispatches request methods to the corresponding instance methods. For example, if you implement a get method, it will be used to handle GET requests.
This can be useful for defining a REST API.
Attributes
| Attribute | Type | Description |
|---|---|---|
| methods | methods is automatically set based on the methods defined on the class. |
Methods
dispatch_request()
@classmethod
def dispatch_request(
kwargs: t.Any
) - > ft.ResponseReturnValue
Dispatches the incoming request to the corresponding instance method based on the HTTP request method (e.g., 'GET' requests are handled by the 'get' method). If a 'HEAD' request is received and no specific 'head' method is defined, it falls back to the 'get' method.
Parameters
| Name | Type | Description |
|---|---|---|
| kwargs | t.Any | Arbitrary keyword arguments extracted from the URL routing, which are passed directly to the HTTP method handler (e.g., 'get', 'post'). |
Returns
| Type | Description |
|---|---|
ft.ResponseReturnValue | The return value from the invoked HTTP method handler, which is typically a response object or a value that can be converted into one. |