File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed
end_to_end_tests/golden-record/my_test_api_client
integration-tests/integration_tests
openapi_python_client/templates Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,10 @@ class AuthenticatedClient(Client):
4242 """A Client which has been authenticated for use on secured endpoints"""
4343
4444 token : str
45+ prefix : str = "Bearer"
46+ auth_header_name : str = "Authorization"
4547
4648 def get_headers (self ) -> Dict [str , str ]:
49+ auth_header_value = f"{ self .prefix } { self .token } " if self .prefix else self .token
4750 """Get headers to be used in authenticated endpoints"""
48- return {"Authorization" : f"Bearer { self .token } " , ** self .headers }
51+ return {self .auth_header_name : auth_header_value , ** self .headers }
Original file line number Diff line number Diff line change @@ -42,7 +42,10 @@ class AuthenticatedClient(Client):
4242 """A Client which has been authenticated for use on secured endpoints"""
4343
4444 token : str
45+ prefix : str = "Bearer"
46+ auth_header_name : str = "Authorization"
4547
4648 def get_headers (self ) -> Dict [str , str ]:
49+ auth_header_value = f"{ self .prefix } { self .token } " if self .prefix else self .token
4750 """Get headers to be used in authenticated endpoints"""
48- return {"Authorization" : f"Bearer { self .token } " , ** self .headers }
51+ return {self .auth_header_name : auth_header_value , ** self .headers }
Original file line number Diff line number Diff line change @@ -39,7 +39,10 @@ class AuthenticatedClient(Client):
3939 """ A Client which has been authenticated for use on secured endpoints """
4040
4141 token: str
42+ prefix: str = "Bearer"
43+ auth_header_name: str = "Authorization"
4244
4345 def get_headers(self) -> Dict[str, str]:
44- """ Get headers to be used in authenticated endpoints """
45- return {"Authorization": f"Bearer {self.token}", **self.headers}
46+ auth_header_value = f"{self.prefix} {self.token}" if self.prefix else self.token
47+ """Get headers to be used in authenticated endpoints"""
48+ return {self.auth_header_name: auth_header_value, **self.headers}
You can’t perform that action at this time.
0 commit comments