Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 22 for override (0.22 sec)

  1. docs/en/docs/advanced/testing-database.md

    {!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
    ```
    
    ## Dependency override
    
    Now we create the dependency override and add it to the overrides for our app.
    
    ```Python hl_lines="19-24  27"
    {!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
    ```
    
    !!! tip
        The code for `override_get_db()` is almost exactly the same as for `get_db()`, but in `override_get_db()` we use the `TestingSessionLocal` for the testing database instead.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3.5K bytes
    - Viewed (0)
  2. docs/em/docs/advanced/testing-database.md

    ```
    
    ## 🔗 🔐
    
    🔜 👥 ✍ 🔗 🔐 & 🚮 ⚫️ 🔐 👆 📱.
    
    ```Python hl_lines="19-24  27"
    {!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
    ```
    
    !!! tip
        📟 `override_get_db()` 🌖 ⚫️❔ 🎏 `get_db()`, ✋️ `override_get_db()` 👥 ⚙️ `TestingSessionLocal` 🔬 💽 ↩️.
    
    ## 💯 📱
    
    ⤴️ 👥 💪 💯 📱 🛎.
    
    ```Python hl_lines="32-47"
    {!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 2.6K bytes
    - Viewed (0)
  3. docs/en/docs/how-to/custom-request-and-route.md

    # Custom Request and APIRoute class
    
    In some cases, you may want to override the logic used by the `Request` and `APIRoute` classes.
    
    In particular, this may be a good alternative to logic in a middleware.
    
    For example, if you want to read or manipulate the request body before it is processed by your application.
    
    !!! danger
        This is an "advanced" feature.
    
        If you are just starting with **FastAPI** you might want to skip this section.
    
    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)
  4. docs/de/docs/reference/fastapi.md

    ```python
    from fastapi import FastAPI
    ```
    
    ::: fastapi.FastAPI
        options:
            members:
                - openapi_version
                - webhooks
                - state
                - dependency_overrides
                - openapi
                - websocket
                - include_router
                - get
                - put
                - post
                - delete
                - options
                - head
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Feb 18 12:19:32 GMT 2024
    - 715 bytes
    - Viewed (0)
  5. docs/en/docs/advanced/custom-response.md

    !!! info
        Of course, the actual `Content-Type` header, status code, etc, will come from the `Response` object you returned.
    
    ### Document in OpenAPI and override `Response`
    
    If you want to override the response from inside of the function but at the same time document the "media type" in OpenAPI, you can use the `response_class` parameter AND return a `Response` object.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.7K bytes
    - Viewed (0)
  6. docs/en/docs/how-to/extending-openapi.md

    ## Overriding the defaults
    
    Using the information above, you can use the same utility function to generate the OpenAPI schema and override each part that you need.
    
    For example, let's add <a href="https://github.com/Rebilly/ReDoc/blob/master/docs/redoc-vendor-extensions.md#x-logo" class="external-link" target="_blank">ReDoc's OpenAPI extension to include a custom logo</a>.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Aug 19 19:54:04 GMT 2023
    - 3.2K bytes
    - Viewed (0)
  7. docs/en/docs/release-notes.md

        * PR [#292](https://github.com/tiangolo/fastapi/pull/292).
    
    * Implement dependency overrides for testing.
        * This allows using overrides/mocks of dependencies during tests.
        * New docs: [Testing Dependencies with Overrides](https://fastapi.tiangolo.com/advanced/testing-dependencies/).
        * PR [#291](https://github.com/tiangolo/fastapi/pull/291).
    
    ## 0.27.2
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 03 23:25:42 GMT 2024
    - 388.1K bytes
    - Viewed (1)
  8. docs/en/docs/advanced/response-directly.md

    It won't do any data conversion with Pydantic models, it won't convert the contents to any type, etc.
    
    This gives you a lot of flexibility. You can return any data type, override any data declaration or validation, etc.
    
    ## Using the `jsonable_encoder` in a `Response`
    
    Because **FastAPI** doesn't do any change to a `Response` you return, you have to make sure it's contents are ready for it.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Aug 29 14:02:58 GMT 2020
    - 3K bytes
    - Viewed (0)
  9. docs/zh/docs/advanced/testing-dependencies.md

    常见实例是调用外部第三方身份验证应用。
    
    向第三方应用发送令牌,然后返回经验证的用户。
    
    但第三方服务商处理每次请求都可能会收费,并且耗时通常也比调用写死的模拟测试用户更长。
    
    一般只要测试一次外部验证应用就够了,不必每次测试都去调用。
    
    此时,最好覆盖调用外部验证应用的依赖项,使用返回模拟测试用户的自定义依赖项就可以了。
    
    ### 使用 `app.dependency_overrides` 属性
    
    对于这些用例,**FastAPI** 应用支持 `app.dependcy_overrides` 属性,该属性就是**字典**。
    
    要在测试时覆盖原有依赖项,这个字典的键应当是原依赖项(函数),值是覆盖依赖项(另一个函数)。
    
    这样一来,**FastAPI** 就会调用覆盖依赖项,不再调用原依赖项。
    
    ```Python hl_lines="26-27  30"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 22:45:53 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  10. docs/em/docs/advanced/testing-dependencies.md

    👆 🎲 💚 💯 🔢 🐕‍🦺 🕐, ✋️ 🚫 🎯 🤙 ⚫️ 🔠 💯 👈 🏃.
    
    👉 💼, 👆 💪 🔐 🔗 👈 🤙 👈 🐕‍🦺, &amp; ⚙️ 🛃 🔗 👈 📨 🎁 👩‍💻, 🕴 👆 💯.
    
    ### ⚙️ `app.dependency_overrides` 🔢
    
    👫 💼, 👆 **FastAPI** 🈸 ✔️ 🔢 `app.dependency_overrides`, ⚫️ 🙅 `dict`.
    
    🔐 🔗 🔬, 👆 🚮 🔑 ⏮️ 🔗 (🔢), &amp; 💲, 👆 🔗 🔐 (➕1️⃣ 🔢).
    
    &amp; ⤴️ **FastAPI** 🔜 🤙 👈 🔐 ↩️ ⏮️ 🔗.
    
    ```Python hl_lines="28-29  32"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 1.8K bytes
    - Viewed (0)
Back to top