MCPcopy
hub / github.com/pallets/flask / response

Method response

src/flask/json/provider.py:89–105  ·  view source on GitHub ↗

Serialize the given arguments as JSON, and return a :class:`~flask.Response` object with the ``application/json`` mimetype. The :func:`~flask.json.jsonify` function calls this method for the current application. Either positional or keyword arguments can be

(self, *args: t.Any, **kwargs: t.Any)

Source from the content-addressed store, hash-verified

87 return args or kwargs
88
89 def response(self, *args: t.Any, **kwargs: t.Any) -> Response:
90 """Serialize the given arguments as JSON, and return a
91 :class:`~flask.Response` object with the ``application/json``
92 mimetype.
93
94 The :func:`~flask.json.jsonify` function calls this method for
95 the current application.
96
97 Either positional or keyword arguments can be given, not both.
98 If no arguments are given, ``None`` is serialized.
99
100 :param args: A single value to serialize, or multiple values to
101 treat as a list to serialize.
102 :param kwargs: Treat as a dict to serialize.
103 """
104 obj = self._prepare_response_obj(args, kwargs)
105 return self._app.response_class(self.dumps(obj), mimetype="application/json")
106
107
108def _default(o: t.Any) -> t.Any:

Callers 3

make_responseMethod · 0.45
jsonifyFunction · 0.45

Calls 2

_prepare_response_objMethod · 0.95
dumpsMethod · 0.95

Tested by 1