@@ -244,11 +244,20 @@ def get_request_headers(self) -> Dict[str, str]:
244244 headers : Dict [str , str ] = {}
245245
246246 # Собираем заголовки из различных источников
247- if hasattr (self ._client , "_auth_headers" ):
247+ if (
248+ hasattr (self ._client , "_auth_headers" )
249+ and self ._client ._auth_headers
250+ ):
248251 headers .update (self ._client ._auth_headers ) # type: ignore[reportAttributeAccessIssue]
249- if hasattr (self ._client , "default_headers" ):
252+ if (
253+ hasattr (self ._client , "default_headers" )
254+ and self ._client .default_headers
255+ ):
250256 headers .update (self ._client .default_headers ) # type: ignore[reportAttributeAccessIssue]
251- if hasattr (self ._client , "_default_headers" ):
257+ if (
258+ hasattr (self ._client , "_default_headers" )
259+ and self ._client ._default_headers
260+ ):
252261 headers .update (self ._client ._default_headers ) # type: ignore[reportAttributeAccessIssue]
253262 if hasattr (self , "default_headers" ) and self .default_headers :
254263 headers .update (self .default_headers ) # type: ignore[reportAttributeAccessIssue]
@@ -485,11 +494,20 @@ def get_request_headers(self) -> Dict[str, str]:
485494 headers : Dict [str , str ] = {}
486495
487496 # Собираем заголовки из различных источников
488- if hasattr (self ._client , "_auth_headers" ):
497+ if (
498+ hasattr (self ._client , "_auth_headers" )
499+ and self ._client ._auth_headers
500+ ):
489501 headers .update (self ._client ._auth_headers ) # type: ignore[reportAttributeAccessIssue]
490- if hasattr (self ._client , "default_headers" ):
502+ if (
503+ hasattr (self ._client , "default_headers" )
504+ and self ._client .default_headers
505+ ):
491506 headers .update (self ._client .default_headers ) # type: ignore[reportAttributeAccessIssue]
492- if hasattr (self ._client , "_default_headers" ):
507+ if (
508+ hasattr (self ._client , "_default_headers" )
509+ and self ._client ._default_headers
510+ ):
493511 headers .update (self ._client ._default_headers ) # type: ignore[reportAttributeAccessIssue]
494512 if hasattr (self , "default_headers" ) and self .default_headers :
495513 headers .update (self .default_headers ) # type: ignore[reportAttributeAccessIssue]
0 commit comments