We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7955faa commit 9330fb7Copy full SHA for 9330fb7
openapi_python_client/templates/client.py.jinja
@@ -39,7 +39,10 @@ class AuthenticatedClient(Client):
39
""" A Client which has been authenticated for use on secured endpoints """
40
41
token: str
42
+ prefix: str = "Bearer"
43
+ auth_header_name: str = "Authorization"
44
45
def get_headers(self) -> Dict[str, str]:
- """ Get headers to be used in authenticated endpoints """
- 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}
0 commit comments