Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 139 for responses (0.17 sec)

  1. docs/en/docs/reference/responses.md

    # Custom Response Classes - File, HTML, Redirect, Streaming, etc.
    
    There are several custom response classes you can use to create an instance and return them directly from your *path operations*.
    
    Read more about it in the [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/).
    
    You can import them directly from `fastapi.responses`:
    
    ```python
    from fastapi.responses import (
        FileResponse,
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  2. docs/fr/docs/advanced/additional-responses.md

    Vous pouvez déclarer un `response_model`, en utilisant le code HTTP par défaut `200` (ou un code personnalisé si vous en avez besoin), puis déclarer des informations supplémentaires pour cette même réponse dans `responses`, directement dans le schéma OpenAPI.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 9.6K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_bigger_applications/test_main_an.py

        assert response.status_code == 200, response.text
        assert response.json() == {"item_id": "plumbus", "name": "The great Plumbus"}
    
    
    def test_put_forbidden(client: TestClient):
        response = client.put(
            "/items/bar?token=jessica", headers={"X-Token": "fake-super-secret-token"}
        )
        assert response.status_code == 403, response.text
        assert response.json() == {"detail": "You can only update the item: plumbus"}
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 24.6K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_bigger_applications/test_main_an_py39.py

        )
        assert response.status_code == 200, response.text
        assert response.json() == {"item_id": "plumbus", "name": "The great Plumbus"}
    
    
    @needs_py39
    def test_put_forbidden(client: TestClient):
        response = client.put(
            "/items/bar?token=jessica", headers={"X-Token": "fake-super-secret-token"}
        )
        assert response.status_code == 403, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 24.9K bytes
    - Viewed (0)
  5. docs/em/docs/advanced/path-operation-advanced-configuration.md

    ⚫️ ✔️ 🌐 ℹ 🔃 *➡ 🛠️* & ⚙️ 🏗 🏧 🧾.
    
    ⚫️ 🔌 `tags`, `parameters`, `requestBody`, `responses`, ♒️.
    
    👉 *➡ 🛠️*-🎯 🗄 🔗 🛎 🏗 🔁 **FastAPI**, ✋️ 👆 💪 ↔ ⚫️.
    
    !!! tip
        👉 🔅 🎚 ↔ ☝.
    
        🚥 👆 🕴 💪 📣 🌖 📨, 🌅 🏪 🌌 ⚫️ ⏮️ [🌖 📨 🗄](additional-responses.md){.internal-link target=_blank}.
    
    👆 💪 ↔ 🗄 🔗 *➡ 🛠️* ⚙️ 🔢 `openapi_extra`.
    
    ### 🗄 ↔
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 5.7K bytes
    - Viewed (0)
  6. tests/test_application.py

        assert response.status_code == 200, response.text
        assert response.headers["content-type"] == "text/html; charset=utf-8"
        assert "window.opener.swaggerUIRedirectOauth2" in response.text
    
    
    def test_redoc():
        response = client.get("/redoc")
        assert response.status_code == 200, response.text
        assert response.headers["content-type"] == "text/html; charset=utf-8"
        assert "redoc@next" in response.text
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 52.2K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_dependencies/test_tutorial012_an.py

    def test_get_invalid_one_header_items():
        response = client.get("/items/", headers={"X-Token": "invalid"})
        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "X-Token header invalid"}
    
    
    def test_get_invalid_one_users():
        response = client.get("/users/", headers={"X-Token": "invalid"})
        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "X-Token header invalid"}
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_handling_errors/test_tutorial005.py

        )
    
    
    def test_post():
        data = {"title": "towel", "size": 5}
        response = client.post("/items/", json=data)
        assert response.status_code == 200, response.text
        assert response.json() == data
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 4.3K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_request_files/test_tutorial002.py

        response = client.get("/")
        assert response.status_code == 200, response.text
        assert b"<form" in response.content
    
    
    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": {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 8.5K bytes
    - Viewed (0)
  10. docs/en/docs/tutorial/bigger-applications.md

    ### Add some custom `tags`, `responses`, and `dependencies`
    
    We are not adding the prefix `/items` nor the `tags=["items"]` to each *path operation* because we added them to the `APIRouter`.
    
    But we can still add _more_ `tags` that will be applied to a specific *path operation*, and also some extra `responses` specific to that *path operation*:
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 18.6K bytes
    - Viewed (0)
Back to top