Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for 27 (0.13 sec)

  1. docs/zh/docs/advanced/custom-response.md

    例如,如果你需要压榨性能,你可以安装并使用 <a href="https://github.com/ijl/orjson" class="external-link" target="_blank">`orjson`</a> 并将响应设置为 `ORJSONResponse`。
    
    导入你想要使用的 `Response` 类(子类)然后在 *路径操作装饰器* 中声明它。
    
    ```Python hl_lines="2 7"
    {!../../../docs_src/custom_response/tutorial001b.py!}
    ```
    
    !!! info "提示"
        参数 `response_class` 也会用来定义响应的「媒体类型」。
    
        在这个例子中,HTTP 头的 `Content-Type` 会被设置成 `application/json`。
    
        并且在 OpenAPI 文档中也会这样记录。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 12 00:06:16 GMT 2022
    - 7.8K bytes
    - Viewed (1)
  2. docs/em/docs/advanced/custom-response.md

    ✋️ 🚥 👆 🎯 👈 🎚 👈 👆 🛬 **🎻 ⏮️ 🎻**, 👆 💪 🚶‍♀️ ⚫️ 🔗 📨 🎓 &amp; ❎ ➕ 🌥 👈 FastAPI 🔜 ✔️ 🚶‍♀️ 👆 📨 🎚 🔘 `jsonable_encoder` ⏭ 🚶‍♀️ ⚫️ 📨 🎓.
    
    ```Python hl_lines="2  7"
    {!../../../docs_src/custom_response/tutorial001b.py!}
    ```
    
    !!! info
        🔢 `response_class` 🔜 ⚙️ 🔬 "📻 🆎" 📨.
    
        👉 💼, 🇺🇸🔍 🎚 `Content-Type` 🔜 ⚒ `application/json`.
    
         &amp; ⚫️ 🔜 📄 ✅ 🗄.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 9.8K bytes
    - Viewed (0)
Back to top