Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 33 for original (0.24 sec)

  1. fastapi/utils.py

        original_type = field.type_
        if is_dataclass(original_type) and hasattr(original_type, "__pydantic_model__"):
            original_type = original_type.__pydantic_model__
        use_type = original_type
        if lenient_issubclass(original_type, BaseModel):
            original_type = cast(Type[BaseModel], original_type)
            use_type = cloned_types.get(original_type)
            if use_type is None:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  2. docs_src/custom_request_and_route/tutorial003.py

    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)
                duration = time.time() - before
                response.headers["X-Response-Time"] = str(duration)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 1K bytes
    - Viewed (0)
  3. docs_src/custom_request_and_route/tutorial002.py

    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)
                except RequestValidationError as exc:
                    body = await request.body()
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 932 bytes
    - Viewed (0)
  4. docs/en/docs/how-to/custom-request-and-route.md

    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.
    
    ```Python hl_lines="18-26"
    {!../../../docs_src/custom_request_and_route/tutorial001.py!}
    ```
    
    !!! note "Technical Details"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Mar 31 23:52:53 GMT 2024
    - 4.4K bytes
    - Viewed (0)
  5. docs/en/docs/advanced/testing-dependencies.md

    There are some scenarios where you might want to override a dependency during testing.
    
    You don't want the original dependency to run (nor any of the sub-dependencies it might have).
    
    Instead, you want to provide a different dependency that will be used only during tests (possibly only some specific tests), and will provide a value that can be used where the value of the original dependency was used.
    
    ### Use cases: external service
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 2.9K bytes
    - Viewed (0)
  6. docs/ko/docs/tutorial/cors.md

    ```
    
    `CORSMiddleware` 에서 사용하는 기본 매개변수는 제한적이므로, 브라우저가 교차-도메인 상황에서 특정한 출처, 메소드, 헤더 등을 사용할 수 있도록 하려면 이들을 명시적으로 허용해야 합니다.
    
    다음의 인자들이 지원됩니다:
    
    * `allow_origins` - 교차-출처 요청을 보낼 수 있는 출처의 리스트입니다. 예) `['https://example.org', 'https://www.example.org']`. 모든 출처를 허용하기 위해 `['*']` 를 사용할 수 있습니다.
    * `allow_origin_regex` - 교차-출처 요청을 보낼 수 있는 출처를 정규표현식 문자열로 나타냅니다.  `'https://.*\.example\.org'`.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Jan 07 14:21:23 GMT 2023
    - 5.8K bytes
    - Viewed (0)
  7. docs/zh/docs/tutorial/cors.md

    * `expose_headers` - 指示可以被浏览器访问的响应头。默认为 `[]`。
    * `max_age` - 设定浏览器缓存 CORS 响应的最长时间,单位是秒。默认为 `600`。
    
    中间件响应两种特定类型的 HTTP 请求……
    
    ### CORS 预检请求
    
    这是些带有 `Origin` 和 `Access-Control-Request-Method` 请求头的 `OPTIONS` 请求。
    
    在这种情况下,中间件将拦截传入的请求并进行响应,出于提供信息的目的返回一个使用了适当的 CORS headers 的 `200` 或 `400` 响应。
    
    ### 简单请求
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 27 17:28:07 GMT 2021
    - 4.5K bytes
    - Viewed (0)
  8. docs/ja/docs/tutorial/cors.md

    このミドルウェアは2種類のHTTPリクエストに応答します...
    
    ### CORSプリフライトリクエスト
    
    これらは、 `Origin` ヘッダーと `Access-Control-Request-Method` ヘッダーを持つ `OPTIONS` リクエストです。
    
    この場合、ミドルウェアはリクエストを横取りし、適切なCORSヘッダーと共に情報提供のために `200` または `400` のレスポンスを返します。
    
    ### シンプルなリクエスト
    
    `Origin` ヘッダーのあるリクエスト。この場合、ミドルウェアは通常どおりリクエストに何もしないですが、レスポンスに適切なCORSヘッダーを加えます。
    
    ## より詳しい情報
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Oct 18 06:02:19 GMT 2020
    - 6.3K bytes
    - Viewed (0)
  9. docs_src/custom_request_and_route/tutorial001.py

            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)
                return await original_route_handler(request)
    
            return custom_route_handler
    
    
    app = FastAPI()
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 973 bytes
    - Viewed (0)
  10. docs/fr/docs/project-generation.md

    * Modèle de démarrages basiques pour les utilisateurs (à modifier et supprimer au besoin).
    * Migrations **Alembic**.
    * **CORS** (partage des ressources entre origines multiples, ou *Cross Origin Resource Sharing*).
    * *Worker* **Celery** pouvant importer et utiliser les modèles et le code du reste du backend.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 02 14:18:06 GMT 2021
    - 6.7K bytes
    - Viewed (0)
Back to top