MCPcopy Create free account
hub / github.com/encode/starlette / receive_json

Method receive_json

starlette/testclient.py:195–202  ·  view source on GitHub ↗
(self, mode: Literal["text", "binary"] = "text")

Source from the content-addressed store, hash-verified

193 return cast(bytes, message["bytes"])
194
195 def receive_json(self, mode: Literal["text", "binary"] = "text") -> Any:
196 message = self.receive()
197 self._raise_on_close(message)
198 if mode == "text":
199 text = message["text"]
200 else:
201 text = message["bytes"].decode("utf-8")
202 return json.loads(text)
203
204
205class _TestClientTransport(httpx.BaseTransport):

Callers

nothing calls this directly

Calls 3

receiveMethod · 0.95
_raise_on_closeMethod · 0.95
decodeMethod · 0.80

Tested by

no test coverage detected