Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 632 for RESPONSE (0.05 seconds)

The search processing time has exceeded the limit. The displayed results may be partial.

  1. docs/en/docs/advanced/response-directly.md

    /// tip
    
    You will normally have much better performance using a [Response Model](../tutorial/response-model.md) than returning a `JSONResponse` directly, as that way it serializes the data using Pydantic, in Rust.
    
    ///
    
    ## Return a `Response` { #return-a-response }
    
    You can return a `Response` or any sub-class of it.
    
    /// info
    
    `JSONResponse` itself is a sub-class of `Response`.
    
    ///
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 4K bytes
    - Click Count (0)
  2. docs/en/docs/advanced/response-headers.md

    # Response Headers { #response-headers }
    
    ## Use a `Response` parameter { #use-a-response-parameter }
    
    You can declare a parameter of type `Response` in your *path operation function* (as you can do for cookies).
    
    And then you can set headers in that *temporal* response object.
    
    {* ../../docs_src/response_headers/tutorial002_py310.py hl[1, 7:8] *}
    
    And then you can return any object you need, as you normally would (a `dict`, a database model, etc).
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 2.2K bytes
    - Click Count (0)
  3. docs/zh/docs/advanced/response-cookies.md

    你也可以在依赖中定义`Response`参数,并设置cookie和header。
    
    ## 直接响应 `Response` { #return-a-response-directly }
    
    你还可以在直接响应`Response`时直接创建cookies。
    
    为此,你可以按照[直接返回 Response](response-directly.md)中的说明创建一个响应。
    
    然后设置Cookies,并返回:
    
    {* ../../docs_src/response_cookies/tutorial001_py310.py hl[10:12] *}
    
    /// tip | 提示
    
    需要注意,如果你直接反馈一个response对象,而不是使用`Response`入参,FastAPI则会直接反馈你封装的response对象。
    
    所以你需要确保你响应数据类型的正确性,如:你可以使用`JSONResponse`来兼容JSON的场景。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 2.1K bytes
    - Click Count (0)
  4. docs/zh-hant/docs/tutorial/response-model.md

    <img src="/img/tutorial/response-model/image01.png">
    
    而且兩個模型都會用在互動式 API 文件中:
    
    <img src="/img/tutorial/response-model/image02.png">
    
    ## 其他回傳型別註解 { #other-return-type-annotations }
    
    有時你回傳的東西不是有效的 Pydantic 欄位,你仍會在函式上加上註解,只為了獲得工具(編輯器、mypy 等)提供的支援。
    
    ### 直接回傳 Response { #return-a-response-directly }
    
    最常見的情況是[直接回傳 Response(在進階文件中稍後會解釋)](../advanced/response-directly.md)。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 14.5K bytes
    - Click Count (0)
  5. docs/en/docs/advanced/response-cookies.md

    # Response Cookies { #response-cookies }
    
    ## Use a `Response` parameter { #use-a-response-parameter }
    
    You can declare a parameter of type `Response` in your *path operation function*.
    
    And then you can set cookies in that *temporal* response object.
    
    {* ../../docs_src/response_cookies/tutorial002_py310.py hl[1, 8:9] *}
    
    And then you can return any object you need, as you normally would (a `dict`, a database model, etc).
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 2.2K bytes
    - Click Count (0)
  6. docs/ja/docs/tutorial/response-status-code.md

    <img src="/img/tutorial/response-status-code/image02.png">
    
    /// note | 技術詳細
    
    また、`from starlette import status`を使うこともできます。
    
    **FastAPI** は、開発者の利便性を考慮して、fastapi.statusと同じ`starlette.status`を提供しています。しかし、これはStarletteから直接提供されています。
    
    ///
    
    ## デフォルトの変更 { #changing-the-default }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 5.6K bytes
    - Click Count (0)
  7. docs/en/docs/advanced/response-change-status-code.md

    For those cases, you can use a `Response` parameter.
    
    ## Use a `Response` parameter { #use-a-response-parameter }
    
    You can declare a parameter of type `Response` in your *path operation function* (as you can do for cookies and headers).
    
    And then you can set the `status_code` in that *temporal* response object.
    
    {* ../../docs_src/response_change_status_code/tutorial001_py310.py hl[1,9,12] *}
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 1.5K bytes
    - Click Count (0)
  8. docs/en/docs/reference/response.md

    # `Response` class
    
    You can declare a parameter in a *path operation function* or dependency to be of type `Response` and then you can set data for the response like headers or cookies.
    
    You can also use it directly to create an instance of it and return it from your *path operations*.
    
    Read more about it in the [FastAPI docs about returning a custom Response](https://fastapi.tiangolo.com/advanced/response-directly/#returning-a-custom-response)
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 04 12:41:54 GMT 2026
    - 559 bytes
    - Click Count (0)
  9. docs/zh-hant/docs/advanced/custom-response.md

    # 自訂回應——HTML、串流、檔案與其他 { #custom-response-html-stream-file-others }
    
    預設情況下,**FastAPI** 會回傳 JSON 回應。
    
    你可以像在[直接回傳 Response](response-directly.md)中所示,直接回傳一個 `Response` 來覆寫它。
    
    但如果你直接回傳一個 `Response`(或其子類別,例如 `JSONResponse`),資料將不會被自動轉換(即使你宣告了 `response_model`),而且文件也不會自動產生(例如,在產生的 OpenAPI 中包含 HTTP 標頭 `Content-Type` 的特定「media type」)。
    
    你也可以在「路徑操作裝飾器」中使用 `response_class` 參數,宣告要使用的 `Response`(例如任意 `Response` 子類別)。
    
    你從「路徑操作函式」回傳的內容,會被放進該 `Response` 中。
    
    /// note
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 10.3K bytes
    - Click Count (0)
  10. docs/en/docs/advanced/custom-response.md

    # Custom Response - HTML, Stream, File, others { #custom-response-html-stream-file-others }
    
    By default, **FastAPI** will return JSON responses.
    
    You can override it by returning a `Response` directly as seen in [Return a Response directly](response-directly.md).
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 11K bytes
    - Click Count (0)
Back to Top