File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -490,12 +490,17 @@ def _build_request(
490
490
if not files :
491
491
files = cast (HttpxRequestFiles , ForceMultipartDict ())
492
492
493
+ prepared_url = self ._prepare_url (options .url )
494
+ if "_" in prepared_url .host :
495
+ # work around https://github.com/encode/httpx/discussions/2880
496
+ kwargs ["extensions" ] = {"sni_hostname" : prepared_url .host .replace ("_" , "-" )}
497
+
493
498
# TODO: report this error to httpx
494
499
return self ._client .build_request ( # pyright: ignore[reportUnknownMemberType]
495
500
headers = headers ,
496
501
timeout = self .timeout if isinstance (options .timeout , NotGiven ) else options .timeout ,
497
502
method = options .method ,
498
- url = self . _prepare_url ( options . url ) ,
503
+ url = prepared_url ,
499
504
# the `Query` type that we use is incompatible with qs'
500
505
# `Params` type as it needs to be typed as `Mapping[str, object]`
501
506
# so that passing a `TypedDict` doesn't cause an error.
You can’t perform that action at this time.
0 commit comments