fix: coerce non-string custom header values to str before sending

aiohttp requires all header values to be strings. Non-string values
(e.g. integers) stored in the connection headers config were passed
through as-is, causing a serialization error at request time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alejandro García Iglesias 2026-04-26 22:23:17 -03:00
parent 823a205fd2
commit 785bc2ca8c

View file

@ -223,9 +223,10 @@ async def get_headers_and_cookies(
}
custom_headers = {}
for k, v in config.get('headers').items():
if isinstance(v, str):
for token, value in template_vars.items():
v = v.replace(token, value)
if not isinstance(v, str):
v = str(v)
for token, value in template_vars.items():
v = v.replace(token, value)
custom_headers[k] = v
headers = {**headers, **custom_headers}