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

Method __init__

starlette/responses.py:225–240  ·  view source on GitHub ↗
(
        self,
        content: ContentStream,
        status_code: int = 200,
        headers: Mapping[str, str] | None = None,
        media_type: str | None = None,
        background: BackgroundTask | None = None,
    )

Source from the content-addressed store, hash-verified

223 body_iterator: AsyncContentStream
224
225 def __init__(
226 self,
227 content: ContentStream,
228 status_code: int = 200,
229 headers: Mapping[str, str] | None = None,
230 media_type: str | None = None,
231 background: BackgroundTask | None = None,
232 ) -> None:
233 if isinstance(content, AsyncIterable):
234 self.body_iterator = content
235 else:
236 self.body_iterator = iterate_in_threadpool(content)
237 self.status_code = status_code
238 self.media_type = self.media_type if media_type is None else media_type
239 self.background = background
240 self.init_headers(headers)
241
242 async def listen_for_disconnect(self, receive: Receive) -> None:
243 while True:

Callers

nothing calls this directly

Calls 2

iterate_in_threadpoolFunction · 0.90
init_headersMethod · 0.80

Tested by

no test coverage detected