Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for response (0.29 sec)

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

    !!! info "提示"
        当然,实际的 `Content-Type` 头,状态码等等,将来自于你返回的 `Response` 对象。
    
    ### OpenAPI 中的文档和重载 `Response`
    
    如果你想要在函数内重载响应,但是同时在 OpenAPI 中文档化「媒体类型」,你可以使用 `response_class` 参数并返回一个 `Response` 对象。
    
    接着 `response_class` 参数只会被用来文档化 OpenAPI 的 *路径操作*,你的 `Response` 用来返回响应。
    
    ### 直接返回 `HTMLResponse`
    
    比如像这样:
    
    ```Python hl_lines="7 23 21"
    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/en/docs/advanced/custom-response.md

        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)
  3. docs/em/docs/advanced/custom-response.md

    #### 📨 `HTMLResponse` 🔗
    
    🖼, ⚫️ 💪 🕳 💖:
    
    ```Python hl_lines="7  21  23"
    {!../../../docs_src/custom_response/tutorial004.py!}
    ```
    
    👉 🖼, 🔢 `generate_html_response()` ⏪ 🏗 & 📨 `Response` ↩️ 🛬 🕸 `str`.
    
    🛬 🏁 🤙 `generate_html_response()`, 👆 ⏪ 🛬 `Response` 👈 🔜 🔐 🔢 **FastAPI** 🎭.
    
    ✋️ 👆 🚶‍♀️ `HTMLResponse` `response_class` 💁‍♂️, **FastAPI** 🔜 💭 ❔ 📄 ⚫️ 🗄 & 🎓 🩺 🕸 ⏮️ `text/html`:
    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)
  4. docs/de/docs/advanced/custom-response.md

    ### In OpenAPI dokumentieren und `Response` überschreiben
    
    Wenn Sie die Response innerhalb der Funktion überschreiben und gleichzeitig den „Medientyp“ in OpenAPI dokumentieren möchten, können Sie den `response_class`-Parameter verwenden UND ein `Response`-Objekt zurückgeben.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Jan 23 13:05:12 GMT 2024
    - 13.5K bytes
    - Viewed (0)
  5. docs/ja/docs/advanced/custom-response.md

    `response_class` はOpenAPIの *path operation* ドキュメントにのみ使用されますが、 `Response` はそのまま使用されます。
    
    #### `HTMLResponse` を直接返す
    
    例えば、このようになります:
    
    ```Python hl_lines="7  21  23"
    {!../../../docs_src/custom_response/tutorial004.py!}
    ```
    
    この例では、関数 `generate_html_response()` は、`str` のHTMLを返すのではなく `Response` を生成して返しています。
    
    `generate_html_response()` を呼び出した結果を返すことにより、**FastAPI** の振る舞いを上書きする `Response` が既に返されています。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Jul 19 19:14:58 GMT 2021
    - 10.7K bytes
    - Viewed (0)
Back to top