Skip to content
This repository has been archived by the owner on Mar 2, 2024. It is now read-only.

Commit

Permalink
Don't check content type header
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jan 11, 2024
1 parent 25d614c commit 1fd8236
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mauigpapi/http/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import logging
import time

from aiohttp import ClientResponse, ClientSession, ContentTypeError, CookieJar
from aiohttp import ClientResponse, ClientSession, CookieJar
from yarl import URL

from mautrix.types import JSON, Serializable
Expand Down Expand Up @@ -246,8 +246,8 @@ async def _handle_response(self, resp: ClientResponse, is_external: bool) -> JSO
if not is_external:
self._handle_response_headers(resp)
try:
body = await resp.json()
except (json.JSONDecodeError, ContentTypeError) as e:
body = await resp.json(content_type=None)
except json.JSONDecodeError as e:
raise IGUnknownError(resp) from e
if not is_external and body.get("status", "fail") == "ok":
return body
Expand All @@ -261,7 +261,7 @@ async def _handle_response(self, resp: ClientResponse, is_external: bool) -> JSO

async def _get_response_error(self, resp: ClientResponse) -> IGResponseError:
try:
data = await resp.json()
data = await resp.json(content_type=None)
except json.JSONDecodeError:
data = {}

Expand Down

0 comments on commit 1fd8236

Please sign in to comment.