MCPcopy
hub / github.com/django/django / __init__

Method __init__

django/http/response.py:751–768  ·  view source on GitHub ↗
(
        self,
        data,
        encoder=DjangoJSONEncoder,
        safe=True,
        json_dumps_params=None,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

749 """
750
751 def __init__(
752 self,
753 data,
754 encoder=DjangoJSONEncoder,
755 safe=True,
756 json_dumps_params=None,
757 **kwargs,
758 ):
759 if safe and not isinstance(data, dict):
760 raise TypeError(
761 "In order to allow non-dict objects to be serialized set the "
762 "safe parameter to False."
763 )
764 if json_dumps_params is None:
765 json_dumps_params = {}
766 kwargs.setdefault("content_type", "application/json")
767 data = json.dumps(data, cls=encoder, **json_dumps_params)
768 super().__init__(content=data, **kwargs)

Callers

nothing calls this directly

Calls 3

setdefaultMethod · 0.45
dumpsMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected