Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 1,335 for Responses (0.2 sec)

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

    你也可以在直接返回`Response`时添加头部。
    
    按照[直接返回响应](response-directly.md){.internal-link target=_blank}中所述创建响应,并将头部作为附加参数传递:
    ```Python hl_lines="10-12"
    {!../../../docs_src/response_headers/tutorial001.py!}
    ```
    
    
    !!! note "技术细节"
        你也可以使用`from starlette.responses import Response`或`from starlette.responses import JSONResponse`。
    
        **FastAPI**提供了与`fastapi.responses`相同的`starlette.responses`,只是为了方便开发者。但是,大多数可用的响应都直接来自Starlette。
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Thu Apr 18 19:53:19 UTC 2024
    - 2K bytes
    - Viewed (0)
  2. tests/test_response_class_no_mediatype.py

        response_class=Response,
        responses={500: {"description": "Error", "model": JsonApiError}},
    )
    async def a():
        pass  # pragma: no cover
    
    
    @app.get("/b", responses={500: {"description": "Error", "model": Error}})
    async def b():
        pass  # pragma: no cover
    
    
    client = TestClient(app)
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.3K bytes
    - Viewed (0)
  3. tests/test_response_code_no_body.py

        assert response.content == b""
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
            "info": {"title": "FastAPI", "version": "0.1.0"},
            "paths": {
                "/a": {
                    "get": {
                        "responses": {
                            "500": {
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.2K bytes
    - Viewed (0)
  4. tests/test_additional_responses_router.py

    
    def test_a():
        response = client.get("/a")
        assert response.status_code == 200, response.text
        assert response.json() == "a"
    
    
    def test_b():
        response = client.get("/b")
        assert response.status_code == 200, response.text
        assert response.json() == "b"
    
    
    def test_c():
        response = client.get("/c")
        assert response.status_code == 200, response.text
        assert response.json() == "c"
    
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 5.1K bytes
    - Viewed (0)
  5. docs/fr/docs/advanced/additional-status-codes.md

    !!! note "Détails techniques"
        Vous pouvez également utiliser `from starlette.responses import JSONResponse`.
    
        Pour plus de commodités, **FastAPI** fournit les objets `starlette.responses` sous forme d'un alias accessible par `fastapi.responses`. Mais la plupart des réponses disponibles proviennent directement de Starlette. Il en est de même avec l'objet `statut`.
    
    ## Documents OpenAPI et API
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Thu Apr 18 19:53:19 UTC 2024
    - 2.3K bytes
    - Viewed (0)
  6. docs/em/docs/advanced/response-directly.md

    ⚫️ 💪 ⚠, 🖼, 📨 🛃 🎚 ⚖️ 🍪.
    
    ## 📨 `Response`
    
    👐, 👆 💪 📨 🙆 `Response` ⚖️ 🙆 🎧-🎓 ⚫️.
    
    !!! tip
        `JSONResponse` ⚫️ 🎧-🎓 `Response`.
    
    & 🕐❔ 👆 📨 `Response`, **FastAPI** 🔜 🚶‍♀️ ⚫️ 🔗.
    
    ⚫️ 🏆 🚫 🙆 💽 🛠️ ⏮️ Pydantic 🏷, ⚫️ 🏆 🚫 🗜 🎚 🙆 🆎, ♒️.
    
    👉 🤝 👆 📚 💪. 👆 💪 📨 🙆 📊 🆎, 🔐 🙆 💽 📄 ⚖️ 🔬, ♒️.
    
    ## ⚙️ `jsonable_encoder` `Response`
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Apr 01 09:26:04 UTC 2023
    - 2.6K bytes
    - Viewed (0)
  7. docs/en/docs/tutorial/extra-data-types.md

        * In requests and responses will be represented as a `str` in ISO 8601 format, like: `2008-09-15T15:53:00+05:00`.
    * `datetime.date`:
        * Python `datetime.date`.
        * In requests and responses will be represented as a `str` in ISO 8601 format, like: `2008-09-15`.
    * `datetime.time`:
        * A Python `datetime.time`.
        * In requests and responses will be represented as a `str` in ISO 8601 format, like: `14:23:55.003`.
    * `datetime.timedelta`:
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Mar 22 01:42:11 UTC 2024
    - 4.1K bytes
    - Viewed (0)
  8. tests/test_response_model_sub_types.py

    
    def test_path_operations():
        response = client.get("/valid1")
        assert response.status_code == 200, response.text
        response = client.get("/valid2")
        assert response.status_code == 200, response.text
        response = client.get("/valid3")
        assert response.status_code == 200, response.text
        response = client.get("/valid4")
        assert response.status_code == 200, response.text
    
    
    def test_openapi_schema():
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 5.3K bytes
    - Viewed (0)
  9. tests/test_additional_responses_response_class.py

        responses={500: {"description": "Error", "model": JsonApiError}},
    )
    async def a():
        pass  # pragma: no cover
    
    
    @app.get("/b", responses={500: {"description": "Error", "model": Error}})
    async def b():
        pass  # pragma: no cover
    
    
    client = TestClient(app)
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.5K bytes
    - Viewed (0)
  10. 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.
    
    ## About HTTP status codes
    
    !!! note
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Aug 29 14:02:58 UTC 2020
    - 4K bytes
    - Viewed (0)
Back to top