Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 6 of 6 for ORJSONResponse (0.07 seconds)

  1. tests/test_deprecated_responses.py

        assert response.json() == {"name": "widget", "price": 9.99}
    
    
    def test_orjson_response_emits_deprecation_warning():
        with pytest.warns(FastAPIDeprecationWarning, match="ORJSONResponse is deprecated"):
            ORJSONResponse(content={"hello": "world"})
    
    
    # UJSON
    
    
    def _make_ujson_app() -> FastAPI:
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", FastAPIDeprecationWarning)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 22 16:34:59 GMT 2026
    - 2K bytes
    - Click Count (0)
  2. tests/test_orjson_response_class.py

    from fastapi.exceptions import FastAPIDeprecationWarning
    from fastapi.responses import ORJSONResponse
    from fastapi.testclient import TestClient
    from sqlalchemy.sql.elements import quoted_name
    
    with warnings.catch_warnings():
        warnings.simplefilter("ignore", FastAPIDeprecationWarning)
        app = FastAPI(default_response_class=ORJSONResponse)
    
    
    @app.get("/orjson_non_str_keys")
    def get_orjson_non_str_keys():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 22 16:34:59 GMT 2026
    - 846 bytes
    - Click Count (0)
  3. docs_src/custom_response/tutorial001b_py310.py

    from fastapi import FastAPI
    from fastapi.responses import ORJSONResponse
    
    app = FastAPI()
    
    
    @app.get("/items/", response_class=ORJSONResponse)
    async def read_items():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 215 bytes
    - Click Count (0)
  4. fastapi/responses.py

        "and https://fastapi.tiangolo.com/tutorial/response-model/",
        category=FastAPIDeprecationWarning,
        stacklevel=2,
    )
    class ORJSONResponse(JSONResponse):
        """JSON response using the orjson library to serialize data to JSON.
    
        **Deprecated**: `ORJSONResponse` is deprecated. FastAPI now serializes data
        directly to JSON bytes via Pydantic when a return type or response model is
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 09:21:52 GMT 2026
    - 3.6K bytes
    - Click Count (0)
  5. tests/test_default_response_class.py

    from fastapi.testclient import TestClient
    
    
    class ORJSONResponse(JSONResponse):
        media_type = "application/x-orjson"
    
        def render(self, content: Any) -> bytes:
            return orjson.dumps(content)
    
    
    class OverrideResponse(JSONResponse):
        media_type = "application/x-override"
    
    
    app = FastAPI(default_response_class=ORJSONResponse)
    router_a = APIRouter()
    router_a_a = APIRouter()
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 20:49:20 GMT 2020
    - 5.2K bytes
    - Click Count (0)
  6. docs/en/docs/reference/responses.md

    You can import them directly from `fastapi.responses`:
    
    ```python
    from fastapi.responses import (
        FileResponse,
        HTMLResponse,
        JSONResponse,
        ORJSONResponse,
        PlainTextResponse,
        RedirectResponse,
        Response,
        StreamingResponse,
        UJSONResponse,
    )
    ```
    
    ## FastAPI Responses
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 22 16:34:59 GMT 2026
    - 4.4K bytes
    - Click Count (0)
Back to Top