Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 3 of 3 for dump_json (0.14 seconds)

  1. tests/test_dump_json_fast_path.py

    
    client = TestClient(app)
    
    
    def test_default_response_class_skips_json_dumps():
        """When no response_class is set, the fast path serializes directly to
        JSON bytes via Pydantic's dump_json and never calls json.dumps."""
        with patch(
            "starlette.responses.json.dumps", wraps=__import__("json").dumps
        ) as mock_dumps:
            response = client.get("/default")
        assert response.status_code == 200
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 22 16:07:19 GMT 2026
    - 1.4K bytes
    - Click Count (0)
  2. fastapi/_compat/v2.py

            # self._type_adapter.validate_python(value)
            # This uses Pydantic's dump_json() which serializes directly to JSON
            # bytes in one pass (via Rust), avoiding the intermediate Python dict
            # step of dump_python(mode="json") + json.dumps().
            return self._type_adapter.dump_json(
                value,
                include=include,
                exclude=exclude,
                by_alias=by_alias,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 15 11:44:39 GMT 2026
    - 16.7K bytes
    - Click Count (0)
  3. fastapi/routing.py

        by_alias: bool = True,
        exclude_unset: bool = False,
        exclude_defaults: bool = False,
        exclude_none: bool = False,
        is_coroutine: bool = True,
        endpoint_ctx: EndpointContext | None = None,
        dump_json: bool = False,
    ) -> Any:
        if field:
            if is_coroutine:
                value, errors = field.validate(response_content, {}, loc=("response",))
            else:
                value, errors = await run_in_threadpool(
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 15 11:44:39 GMT 2026
    - 193K bytes
    - Click Count (0)
Back to Top