MCPcopy
hub / github.com/encode/starlette / receive_json

Method receive_json

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

Source from the content-addressed store, hash-verified

195 return cast(bytes, message["bytes"])
196
197 def receive_json(self, mode: Literal["text", "binary"] = "text") -> Any:
198 message = self.receive()
199 self._raise_on_close(message)
200 if mode == "text":
201 text = message["text"]
202 else:
203 text = message["bytes"].decode("utf-8")
204 return json.loads(text)
205
206
207class _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