Function
json_or_text
(response: aiohttp.ClientResponse)
Source from the content-addressed store, hash-verified
| 108 | |
| 109 | |
| 110 | async def json_or_text(response: aiohttp.ClientResponse) -> Union[Dict[str, Any], str]: |
| 111 | text = await response.text(encoding='utf-8') |
| 112 | try: |
| 113 | if response.headers['content-type'] == 'application/json': |
| 114 | return utils._from_json(text) |
| 115 | except KeyError: |
| 116 | # Thanks Cloudflare |
| 117 | pass |
| 118 | |
| 119 | return text |
| 120 | |
| 121 | |
| 122 | class MultipartParameters(NamedTuple): |
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…