Skip to content

Commit

Permalink
Don't set global headers on client session
Browse files Browse the repository at this point in the history
  • Loading branch information
EvieePy committed Dec 23, 2024
1 parent bb08f39 commit 3584061
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion twitchio/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ async def _init_session(self) -> None:
self._session_set = True

if self._session is not MISSING:
self._session.headers.update(self.headers)
return

logger.debug("Initialising ClientSession on %s.", self.__class__.__qualname__)
Expand Down Expand Up @@ -436,6 +435,7 @@ async def request(self, route: Route) -> RawResponse | str | None:
assert self._session is not None

logger.debug("Attempting a request to %r with %s.", route, self.__class__.__qualname__)
route.headers.update(self.headers)

async with self._session.request(
route.method,
Expand All @@ -459,6 +459,7 @@ async def request(self, route: Route) -> RawResponse | str | None:
return data

async def request_json(self, route: Route) -> Any:
route.headers.update({"Accept": "application/json"})
data = await self.request(route)

if isinstance(data, str):
Expand Down

0 comments on commit 3584061

Please sign in to comment.