MCPcopy Create free account
hub / github.com/StackStorm/st2 / add_auth_token_to_headers

Function add_auth_token_to_headers

st2client/st2client/utils/httpclient.py:66–82  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

64
65
66def add_auth_token_to_headers(func):
67 def decorate(*args, **kwargs):
68 headers = kwargs.get("headers", dict())
69
70 token = kwargs.pop("token", None)
71 if token:
72 headers["X-Auth-Token"] = str(token)
73 kwargs["headers"] = headers
74
75 api_key = kwargs.pop("api_key", None)
76 if api_key:
77 headers["St2-Api-Key"] = str(api_key)
78 kwargs["headers"] = headers
79
80 return func(*args, **kwargs)
81
82 return decorate
83
84
85def add_json_content_type_to_headers(func):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected