Skip to content

Commit 8bf96b0

Browse files
fix(client): handle domains with underscores (#169)
1 parent 5241aaf commit 8bf96b0

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/runloop_api_client/_base_client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,12 +489,17 @@ def _build_request(
489489
if not files:
490490
files = cast(HttpxRequestFiles, ForceMultipartDict())
491491

492+
prepared_url = self._prepare_url(options.url)
493+
if "_" in prepared_url.host:
494+
# work around https://github.com/encode/httpx/discussions/2880
495+
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
496+
492497
# TODO: report this error to httpx
493498
return self._client.build_request( # pyright: ignore[reportUnknownMemberType]
494499
headers=headers,
495500
timeout=self.timeout if isinstance(options.timeout, NotGiven) else options.timeout,
496501
method=options.method,
497-
url=self._prepare_url(options.url),
502+
url=prepared_url,
498503
# the `Query` type that we use is incompatible with qs'
499504
# `Params` type as it needs to be typed as `Mapping[str, object]`
500505
# so that passing a `TypedDict` doesn't cause an error.

0 commit comments

Comments
 (0)