Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 461 - 470 of 1,924 for Responses (0.06 seconds)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. docs_src/dependencies/tutorial013_an_py310.py

    import time
    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException
    from fastapi.responses import StreamingResponse
    from sqlmodel import Field, Session, SQLModel, create_engine
    
    engine = create_engine("postgresql+psycopg://postgres:postgres@localhost/db")
    
    
    class User(SQLModel, table=True):
        id: int | None = Field(default=None, primary_key=True)
        name: str
    
    
    app = FastAPI()
    
    
    def get_session():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Mon Sep 29 03:29:38 GMT 2025
    - 937 bytes
    - Click Count (0)
  8. tests/test_multi_query_errors.py

    
    client = TestClient(app)
    
    
    def test_multi_query():
        response = client.get("/items/?q=5&q=6")
        assert response.status_code == 200, response.text
        assert response.json() == {"q": [5, 6]}
    
    
    def test_multi_query_incorrect():
        response = client.get("/items/?q=five&q=six")
        assert response.status_code == 422, response.text
        assert response.json() == {
            "detail": [
                {
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 4.4K bytes
    - Click Count (0)
  9. docs_src/dependencies/tutorial014_an_py310.py

    import time
    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException
    from fastapi.responses import StreamingResponse
    from sqlmodel import Field, Session, SQLModel, create_engine
    
    engine = create_engine("postgresql+psycopg://postgres:postgres@localhost/db")
    
    
    class User(SQLModel, table=True):
        id: int | None = Field(default=None, primary_key=True)
        name: str
    
    
    app = FastAPI()
    
    
    def get_session():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Mon Sep 29 03:29:38 GMT 2025
    - 957 bytes
    - Click Count (0)
  10. docs_src/request_files/tutorial003_py310.py

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