Handles encoding the given `content`, returning a two-tuple of (<headers>, <stream>).
(
content: ResponseContent | None = None,
text: str | None = None,
html: str | None = None,
json: Any | None = None,
)
| 219 | |
| 220 | |
| 221 | def encode_response( |
| 222 | content: ResponseContent | None = None, |
| 223 | text: str | None = None, |
| 224 | html: str | None = None, |
| 225 | json: Any | None = None, |
| 226 | ) -> tuple[dict[str, str], SyncByteStream | AsyncByteStream]: |
| 227 | class="st">""" |
| 228 | Handles encoding the given `content`, returning a two-tuple of |
| 229 | (<headers>, <stream>). |
| 230 | class="st">""" |
| 231 | if content is not None: |
| 232 | return encode_content(content) |
| 233 | elif text is not None: |
| 234 | return encode_text(text) |
| 235 | elif html is not None: |
| 236 | return encode_html(html) |
| 237 | elif json is not None: |
| 238 | return encode_json(json) |
| 239 | |
| 240 | return {}, ByteStream(bclass="st">"") |
no test coverage detected