Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 111 - 120 of 213 for response_mode (0.06 seconds)

  1. docs_src/extra_models/tutorial002_py39.py

        user_in_db = UserInDB(**user_in.model_dump(), hashed_password=hashed_password)
        print("User saved! ..not really")
        return user_in_db
    
    
    @app.post("/user/", response_model=UserOut)
    async def create_user(user_in: UserIn):
        user_saved = fake_save_user(user_in)
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 20 15:55:38 GMT 2025
    - 830 bytes
    - Click Count (0)
  2. docs/ko/docs/advanced/response-headers.md

    {* ../../docs_src/response_headers/tutorial002.py hl[1,7:8] *}
    
    그 후, 일반적으로 사용하듯이 필요한 객체(`dict`, 데이터베이스 모델 등)를 반환할 수 있습니다.
    
    `response_model`을 선언한 경우, 반환한 객체를 필터링하고 변환하는 데 여전히 사용됩니다.
    
    **FastAPI**는 해당 *임시* 응답에서 헤더(쿠키와 상태 코드도 포함)를 추출하여, 여러분이 반환한 값을 포함하는 최종 응답에 `response_model`로 필터링된 값을 넣습니다.
    
    또한, 종속성에서 `Response` 매개변수를 선언하고 그 안에서 헤더(및 쿠키)를 설정할 수 있습니다.
    
    ## `Response` 직접 반환하기
    
    `Response`를 직접 반환할 때에도 헤더를 추가할 수 있습니다.
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Oct 11 17:48:49 GMT 2025
    - 2.5K bytes
    - Click Count (0)
  3. docs_src/pydantic_v1_in_v2/tutorial003_an_py310.py

        description: str | None = None
        size: float
    
    
    class ItemV2(BaseModelV2):
        name: str
        description: str | None = None
        size: float
    
    
    app = FastAPI()
    
    
    @app.post("/items/", response_model=ItemV2)
    async def create_item(item: Item):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Oct 11 16:45:54 GMT 2025
    - 407 bytes
    - Click Count (0)
  4. docs_src/path_operation_configuration/tutorial005_py310.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
        tags: set[str] = set()
    
    
    @app.post(
        "/items/",
        response_model=Item,
        summary="Create an item",
        response_description="The created item",
    )
    async def create_item(item: Item):
        """
        Create an item with all the information:
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 698 bytes
    - Click Count (0)
  5. docs_src/pydantic_v1_in_v2/tutorial003_an_py39.py

        size: float
    
    
    class ItemV2(BaseModelV2):
        name: str
        description: Union[str, None] = None
        size: float
    
    
    app = FastAPI()
    
    
    @app.post("/items/", response_model=ItemV2)
    async def create_item(item: Item):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 445 bytes
    - Click Count (0)
  6. tests/test_tutorial/test_response_model/test_tutorial003_04.py

            pytest.param("tutorial003_04_py310", marks=needs_py310),
        ],
    )
    def test_invalid_response_model(module_name: str) -> None:
        with pytest.raises(FastAPIError):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 453 bytes
    - Click Count (0)
  7. docs_src/path_operation_configuration/tutorial005_py39.py

    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: set[str] = set()
    
    
    @app.post(
        "/items/",
        response_model=Item,
        summary="Create an item",
        response_description="The created item",
    )
    async def create_item(item: Item):
        """
        Create an item with all the information:
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 736 bytes
    - Click Count (0)
  8. docs_src/response_model/tutorial003_05_py310.py

    from fastapi import FastAPI, Response
    from fastapi.responses import RedirectResponse
    
    app = FastAPI()
    
    
    @app.get("/portal", response_model=None)
    async def get_portal(teleport: bool = False) -> Response | dict:
        if teleport:
            return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Tue Jan 10 16:22:47 GMT 2023
    - 373 bytes
    - Click Count (0)
  9. docs_src/extra_models/tutorial004_py39.py

        name: str
        description: str
    
    
    items = [
        {"name": "Foo", "description": "There comes my hero"},
        {"name": "Red", "description": "It's my aeroplane"},
    ]
    
    
    @app.get("/items/", response_model=list[Item])
    async def read_items():
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 356 bytes
    - Click Count (0)
  10. docs_src/dataclasses_/tutorial002_py39.py

        name: str
        price: float
        tags: list[str] = field(default_factory=list)
        description: Union[str, None] = None
        tax: Union[float, None] = None
    
    
    app = FastAPI()
    
    
    @app.get("/items/next", response_model=Item)
    async def read_next_item():
        return {
            "name": "Island In The Moon",
            "price": 12.99,
            "description": "A place to be playin' and havin' fun",
            "tags": ["breater"],
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Dec 26 10:43:02 GMT 2025
    - 543 bytes
    - Click Count (0)
Back to Top