Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 24 for mediaType (0.04 seconds)

  1. fastapi/openapi/models.py

        content: Optional[dict[str, MediaType]] = None
    
    
    class Parameter(ParameterBase):
        name: str
        in_: ParameterInType = Field(alias="in")
    
    
    class Header(ParameterBase):
        pass
    
    
    class RequestBody(BaseModelWithConfig):
        description: Optional[str] = None
        content: dict[str, MediaType]
        required: Optional[bool] = None
    
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 12:54:56 GMT 2025
    - 15.1K bytes
    - Click Count (0)
  2. tests/test_request_body_parameters_media_type.py

    
    @app.post("/shops")
    async def create_shop(
        data: Shop = Body(media_type=media_type),
        included: list[Product] = Body(default=[], media_type=media_type),
    ):
        pass  # pragma: no cover
    
    
    client = TestClient(app)
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 6.3K bytes
    - Click Count (0)
  3. docs_src/response_directly/tutorial002_py39.py

        <shampoo>
        <Header>
            Apply shampoo here.
        </Header>
        <Body>
            You'll have to use soap here.
        </Body>
        </shampoo>
        """
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 354 bytes
    - Click Count (0)
  4. docs_src/custom_response/tutorial009c_py39.py

    from typing import Any
    
    import orjson
    from fastapi import FastAPI, Response
    
    app = FastAPI()
    
    
    class CustomORJSONResponse(Response):
        media_type = "application/json"
    
        def render(self, content: Any) -> bytes:
            assert orjson is not None, "orjson must be installed"
            return orjson.dumps(content, option=orjson.OPT_INDENT_2)
    
    
    @app.get("/", response_class=CustomORJSONResponse)
    async def main():
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 451 bytes
    - Click Count (0)
  5. fastapi/params.py

            include_in_schema: bool = True,
            json_schema_extra: Union[dict[str, Any], None] = None,
            **extra: Any,
        ):
            self.embed = embed
            self.media_type = media_type
            if example is not _Unset:
                warnings.warn(
                    "`example` has been deprecated, please use `examples` instead",
                    category=FastAPIDeprecationWarning,
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 12:54:56 GMT 2025
    - 26.3K bytes
    - Click Count (0)
  6. docs_src/additional_responses/tutorial004_py310.py

        response_model=Item,
        responses={**responses, 200: {"content": {"image/png": {}}}},
    )
    async def read_item(item_id: str, img: bool | None = None):
        if img:
            return FileResponse("image.png", media_type="image/png")
        else:
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 10 08:55:32 GMT 2025
    - 669 bytes
    - Click Count (0)
  7. docs/es/docs/advanced/custom-response.md

    * `status_code` - Un código de estado HTTP `int`.
    * `headers` - Un `dict` de strings.
    * `media_type` - Un `str` que da el media type. Por ejemplo, `"text/html"`.
    
    FastAPI (de hecho Starlette) incluirá automáticamente un header Content-Length. También incluirá un header Content-Type, basado en el `media_type` y añadiendo un conjunto de caracteres para tipos de texto.
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 13.2K bytes
    - Click Count (0)
  8. fastapi/openapi/utils.py

                            )
                            media_type = route_response_media_type or "application/json"
                            additional_schema = (
                                process_response.setdefault("content", {})
                                .setdefault(media_type, {})
                                .setdefault("schema", {})
                            )
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 12:54:56 GMT 2025
    - 23.2K bytes
    - Click Count (0)
  9. docs_src/additional_responses/tutorial002_py310.py

                "description": "Return the JSON item or an image.",
            }
        },
    )
    async def read_item(item_id: str, img: bool | None = None):
        if img:
            return FileResponse("image.png", media_type="image/png")
        else:
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 10 08:55:32 GMT 2025
    - 596 bytes
    - Click Count (0)
  10. docs_src/custom_response/tutorial008_py39.py

    
    @app.get("/")
    def main():
        def iterfile():  # (1)
            with open(some_file_path, mode="rb") as file_like:  # (2)
                yield from file_like  # (3)
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 360 bytes
    - Click Count (0)
Back to Top