Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 18 for get_route_handler (0.16 seconds)

  1. docs_src/custom_request_and_route/tutorial002_an_py310.py

    from fastapi.exceptions import RequestValidationError
    from fastapi.routing import APIRoute
    
    
    class ValidationErrorLoggingRoute(APIRoute):
        def get_route_handler(self) -> Callable:
            original_route_handler = super().get_route_handler()
    
            async def custom_route_handler(request: Request) -> Response:
                try:
                    return await original_route_handler(request)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 10 08:55:32 GMT 2025
    - 974 bytes
    - Click Count (0)
  2. docs_src/custom_request_and_route/tutorial001_py310.py

                    body = gzip.decompress(body)
                self._body = body
            return self._body
    
    
    class GzipRoute(APIRoute):
        def get_route_handler(self) -> Callable:
            original_route_handler = super().get_route_handler()
    
            async def custom_route_handler(request: Request) -> Response:
                request = GzipRequest(request.scope, request.receive)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 10 08:55:32 GMT 2025
    - 976 bytes
    - Click Count (0)
  3. docs_src/custom_request_and_route/tutorial001_an_py310.py

                    body = gzip.decompress(body)
                self._body = body
            return self._body
    
    
    class GzipRoute(APIRoute):
        def get_route_handler(self) -> Callable:
            original_route_handler = super().get_route_handler()
    
            async def custom_route_handler(request: Request) -> Response:
                request = GzipRequest(request.scope, request.receive)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 10 08:55:32 GMT 2025
    - 1015 bytes
    - Click Count (0)
  4. docs_src/custom_request_and_route/tutorial002_py310.py

    from fastapi.exceptions import RequestValidationError
    from fastapi.routing import APIRoute
    
    
    class ValidationErrorLoggingRoute(APIRoute):
        def get_route_handler(self) -> Callable:
            original_route_handler = super().get_route_handler()
    
            async def custom_route_handler(request: Request) -> Response:
                try:
                    return await original_route_handler(request)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 10 08:55:32 GMT 2025
    - 935 bytes
    - Click Count (0)
  5. docs_src/custom_request_and_route/tutorial003_py310.py

    from collections.abc import Callable
    
    from fastapi import APIRouter, FastAPI, Request, Response
    from fastapi.routing import APIRoute
    
    
    class TimedRoute(APIRoute):
        def get_route_handler(self) -> Callable:
            original_route_handler = super().get_route_handler()
    
            async def custom_route_handler(request: Request) -> Response:
                before = time.time()
                response: Response = await original_route_handler(request)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 10 08:55:32 GMT 2025
    - 1K bytes
    - Click Count (0)
  6. docs/en/docs/how-to/custom-request-and-route.md

    Next, we create a custom subclass of `fastapi.routing.APIRoute` that will make use of the `GzipRequest`.
    
    This time, it will overwrite the method `APIRoute.get_route_handler()`.
    
    This method returns a function. And that function is what will receive a request and return a response.
    
    Here we use it to create a `GzipRequest` from the original request.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 4.4K bytes
    - Click Count (0)
  7. docs/ru/docs/how-to/custom-request-and-route.md

    Далее создадим пользовательский подкласс `fastapi.routing.APIRoute`, который будет использовать `GzipRequest`.
    
    На этот раз он переопределит метод `APIRoute.get_route_handler()`.
    
    Этот метод возвращает функцию. Именно эта функция получает HTTP-запрос и возвращает HTTP-ответ.
    
    Здесь мы используем её, чтобы создать `GzipRequest` из исходного HTTP-запроса.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 17:56:20 GMT 2026
    - 7.1K bytes
    - Click Count (0)
  8. docs/pt/docs/how-to/custom-request-and-route.md

    Em seguida, criamos uma subclasse personalizada de `fastapi.routing.APIRoute` que fará uso do `GzipRequest`.
    
    Dessa vez, ele irá sobrescrever o método `APIRoute.get_route_handler()`.
    
    Esse método retorna uma função. E essa função é o que irá receber uma requisição e retornar uma resposta.
    
    Aqui nós usamos para criar um `GzipRequest` a partir da requisição original.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:20:43 GMT 2026
    - 4.9K bytes
    - Click Count (0)
  9. docs/zh-hant/docs/how-to/custom-request-and-route.md

    ### 建立自訂的 `GzipRoute` 類別 { #create-a-custom-gziproute-class }
    
    接著,我們建立 `fastapi.routing.APIRoute` 的自訂子類別,讓它使用 `GzipRequest`。
    
    這次,它會覆寫 `APIRoute.get_route_handler()` 方法。
    
    這個方法會回傳一個函式,而該函式會接收請求並回傳回應。
    
    在這裡,我們用它將原始的請求包裝成 `GzipRequest`。
    
    {* ../../docs_src/custom_request_and_route/tutorial001_an_py310.py hl[19:27] *}
    
    /// note | 技術細節
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 4.2K bytes
    - Click Count (0)
  10. docs/zh/docs/how-to/custom-request-and-route.md

    ### 创建自定义 `GzipRoute` 类 { #create-a-custom-gziproute-class }
    
    接着,我们创建 `fastapi.routing.APIRoute` 的自定义子类来使用 `GzipRequest`。
    
    这次,我们会重写 `APIRoute.get_route_handler()` 方法。
    
    该方法返回一个函数,这个函数负责接收请求并返回响应。
    
    这里我们用它把原始请求包装为 `GzipRequest`。
    
    {* ../../docs_src/custom_request_and_route/tutorial001_an_py310.py hl[19:27] *}
    
    /// note | 技术细节
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 4.1K bytes
    - Click Count (0)
Back to Top