Refined header code, added reverse recursive action
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
def buildHeaders(definition, request, outputs, resolved):
|
||||
headers = {}
|
||||
|
||||
for header_name, header_value in definition.headers.items():
|
||||
value = header_value
|
||||
|
||||
if isinstance(value, dict) and "output" in header_value:
|
||||
value = outputs[value["output"]]
|
||||
|
||||
if isinstance(value, dict) and "os" in header_value:
|
||||
value = os.environ.get(value["os"])
|
||||
|
||||
if isinstance(header_value, dict) and "prefix" in header_value:
|
||||
value = header_value["prefix"] + value
|
||||
|
||||
headers[header_name] = value
|
||||
|
||||
request["headers"] = headers
|
||||
|
||||
return headers
|
||||
Reference in New Issue
Block a user