Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 1,611 for RESPONSE (0.05 seconds)

  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/en/docs/tutorial/response-model.md

    And tools will also be happy because both `RedirectResponse` and `JSONResponse` are subclasses of `Response`, so the type annotation is correct.
    
    ### Annotate a Response Subclass { #annotate-a-response-subclass }
    
    You can also use a subclass of `Response` in the type annotation:
    
    {* ../../docs_src/response_model/tutorial003_03_py310.py hl[8:9] *}
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 15.5K bytes
    - Click Count (0)
  7. docs/en/docs/tutorial/response-status-code.md

    ///
    
    It will:
    
    * Return that status code in the response.
    * Document it as such in the OpenAPI schema (and so, in the user interfaces):
    
    <img src="/img/tutorial/response-status-code/image01.png">
    
    /// note
    
    Some response codes (see the next section) indicate that the response does not have a body.
    
    FastAPI knows this, and will produce OpenAPI docs that state there is no response body.
    
    ///
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 3.9K bytes
    - Click Count (0)
  8. docs/zh-hant/docs/tutorial/response-status-code.md

    它們只是方便用的常數,值與數字相同,但這樣你可以用編輯器的自動完成來找到它們:
    
    <img src="/img/tutorial/response-status-code/image02.png">
    
    /// note | 技術細節
    
    你也可以使用 `from starlette import status`。
    
    **FastAPI** 將同一個 `starlette.status` 以 `fastapi.status` 形式提供,純粹是為了讓你(開發者)方便。但它直接來自 Starlette。
    
    ///
    
    ## 變更預設值 { #changing-the-default }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 3.7K bytes
    - Click Count (0)
  9. 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)
  10. 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)
Back to Top