Search Options

Results per page
Sort
Preferred Languages
Advance

Results 191 - 200 of 1,675 for Responses (0.04 sec)

  1. tests/test_tutorial/test_response_status_code/test_tutorial001_tutorial002.py

    
    def test_create_item(client: TestClient):
        response = client.post("/items/", params={"name": "Test Item"})
        assert response.status_code == 201, response.text
        assert response.json() == {"name": "Test Item"}
    
    
    def test_openapi_schema(client: TestClient):
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 3.3K bytes
    - Viewed (0)
  2. docs_src/additional_responses/tutorial002_py310.py

    from fastapi import FastAPI
    from fastapi.responses import FileResponse
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        id: str
        value: str
    
    
    app = FastAPI()
    
    
    @app.get(
        "/items/{item_id}",
        response_model=Item,
        responses={
            200: {
                "content": {"image/png": {}},
                "description": "Return the JSON item or an image.",
            }
        },
    )
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 10 08:55:32 UTC 2025
    - 596 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_dataclasses/test_tutorial002.py

    def test_get_item(client: TestClient):
        response = client.get("/items/next")
        assert response.status_code == 200
        assert response.json() == {
            "name": "Island In The Moon",
            "price": 12.99,
            "description": "A place to be playin' and havin' fun",
            "tags": ["breater"],
            "tax": None,
        }
    
    
    def test_openapi_schema(client: TestClient):
        response = client.get("/openapi.json")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 2.9K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_response_model/test_tutorial001_tutorial001_01.py

        )
        assert response.status_code == 200, response.text
        assert response.json() == {
            "name": "Test Item",
            "price": 10.5,
            "description": None,
            "tax": None,
            "tags": [],
        }
    
    
    def test_openapi_schema(client: TestClient):
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 6.5K bytes
    - Viewed (0)
  5. docs_src/custom_response/tutorial009_py39.py

    from fastapi import FastAPI
    from fastapi.responses import FileResponse
    
    some_file_path = "large-video-file.mp4"
    app = FastAPI()
    
    
    @app.get("/")
    async def main():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 202 bytes
    - Viewed (0)
  6. docs_src/response_model/tutorial003_04_py310.py

    from fastapi import FastAPI, Response
    from fastapi.responses import RedirectResponse
    
    app = FastAPI()
    
    
    @app.get("/portal")
    async def get_portal(teleport: bool = False) -> Response | dict:
        if teleport:
            return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Jan 10 16:22:47 UTC 2023
    - 352 bytes
    - Viewed (0)
  7. tests/test_security_openid_connect_description.py

        response = client.get("/users/me")
        assert response.status_code == 401, response.text
        assert response.json() == {"detail": "Not authenticated"}
        assert response.headers["WWW-Authenticate"] == "Bearer"
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 24 19:03:06 UTC 2025
    - 2.4K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_response_directly/test_tutorial002.py

        </shampoo>
        """
    
        response = client.get("/legacy/")
        assert response.status_code == 200, response.text
        assert response.headers["content-type"] == "application/xml"
        assert response.text == expected_content
    
    
    def test_openapi_schema(client: TestClient):
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "info": {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.7K bytes
    - Viewed (0)
  9. tests/test_additional_properties.py

    
    def test_additional_properties_post():
        response = client.post("/foo", json={"items": {"foo": 1, "bar": 2}})
        assert response.status_code == 200, response.text
        assert response.json() == {"foo": 1, "bar": 2}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 3.6K bytes
    - Viewed (0)
  10. tests/test_include_route.py

    from fastapi.responses import JSONResponse
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    router = APIRouter()
    
    
    @router.route("/items/")
    def read_items(request: Request):
        return JSONResponse({"hello": "world"})
    
    
    app.include_router(router)
    
    client = TestClient(app)
    
    
    def test_sub_router():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Apr 08 04:37:38 UTC 2020
    - 496 bytes
    - Viewed (0)
Back to top