Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 361 - 370 of 1,544 for Responses (0.2 seconds)

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

  1. docs_src/handling_errors/tutorial004_py310.py

    from fastapi import FastAPI, HTTPException
    from fastapi.exceptions import RequestValidationError
    from fastapi.responses import PlainTextResponse
    from starlette.exceptions import HTTPException as StarletteHTTPException
    
    app = FastAPI()
    
    
    @app.exception_handler(StarletteHTTPException)
    async def http_exception_handler(request, exc):
        return PlainTextResponse(str(exc.detail), status_code=exc.status_code)
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 920 bytes
    - Click Count (0)
  2. tests/test_additional_properties_bool.py

    
    def test_call_invalid():
        response = client.post("/", json={"foo": {"bar": "baz"}})
        assert response.status_code == 422
    
    
    def test_call_valid():
        response = client.post("/", json={})
        assert response.status_code == 200
        assert response.json() == {}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 4.2K bytes
    - Click Count (0)
  3. tests/test_tutorial/test_body_nested_models/test_tutorial006.py

                ],
            },
        }
    
    
    def test_put_only_required(client: TestClient):
        response = client.put(
            "/items/5",
            json={"name": "Foo", "price": 35.4},
        )
        assert response.status_code == 200, response.text
        assert response.json() == {
            "item_id": 5,
            "item": {
                "name": "Foo",
                "description": None,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 9.5K bytes
    - Click Count (0)
  4. tests/test_enforce_once_required_parameter.py

    client = TestClient(app)
    
    
    def test_get_invalid():
        response = client.get("/foo")
        assert response.status_code == 422
    
    
    def test_get_valid():
        response = client.get("/foo", params={"client_id": "bar"})
        assert response.status_code == 200
        assert response.json() == {"client_id": "bar_key", "client_tag": "bar_tag"}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 4.1K bytes
    - Click Count (0)
  5. tests/test_get_request_body.py

    def test_get_with_body():
        body = {"name": "Foo", "description": "Some description", "price": 5.5}
        response = client.request("GET", "/product", json=body)
        assert response.json() == body
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == snapshot(
            {
                "openapi": "3.1.0",
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 4.2K bytes
    - Click Count (0)
  6. tests/test_repeated_dependency_schema.py

    client = TestClient(app)
    
    
    def test_response():
        response = client.get("/", headers={"someheader": "hello"})
        assert response.status_code == status.HTTP_200_OK
        assert response.json() == {"dep1": "hello", "dep2": "hello123"}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == status.HTTP_200_OK
        actual_schema = response.json()
        assert (
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 4K bytes
    - Click Count (0)
  7. docs_src/stream_data/tutorial002_py310.py

    import base64
    from collections.abc import AsyncIterable, Iterable
    from io import BytesIO
    
    from fastapi import FastAPI
    from fastapi.responses import StreamingResponse
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Feb 27 20:51:40 GMT 2026
    - 5.6K bytes
    - Click Count (0)
  8. docs/ja/docs/tutorial/bigger-applications.md

    これで仕組みが分かったので、どれほど複雑でも自分のアプリで相対インポートを使えます。🤓
    
    ### カスタムの `tags`、`responses`、`dependencies` を追加 { #add-some-custom-tags-responses-and-dependencies }
    
    `APIRouter` に追加済みなので、各 *path operation* に `/items` の prefix や `tags=["items"]` を付けていません。
    
    しかし、特定の *path operation* に適用される _追加の_ `tags` や、その *path operation* 固有の追加の `responses` を加えることはできます:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 22.8K bytes
    - Click Count (0)
  9. tests/test_openapi_query_parameter_extension.py

        return {}
    
    
    client = TestClient(app)
    
    
    def test_get_route():
        response = client.get("/")
        assert response.status_code == 200, response.text
        assert response.json() == {}
    
    
    def test_openapi():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == snapshot(
            {
                "openapi": "3.1.0",
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 4.8K bytes
    - Click Count (0)
  10. docs_src/request_files/tutorial002_an_py310.py

    from typing import Annotated
    
    from fastapi import FastAPI, File, UploadFile
    from fastapi.responses import HTMLResponse
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_files(files: Annotated[list[bytes], File()]):
        return {"file_sizes": [len(file) for file in files]}
    
    
    @app.post("/uploadfiles/")
    async def create_upload_files(files: list[UploadFile]):
        return {"filenames": [file.filename for file in files]}
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 826 bytes
    - Click Count (0)
Back to Top