Open burnash opened 1 week ago
Currently, the response_actions configuration within the REST API source only supports basic string actions like "ignore".
response_actions
{ "path": "issues", "response_actions": [ {"status_code": 404, "action": "ignore"}, {"content": "Not found", "action": "ignore"}, {"status_code": 200, "content": "some text", "action": "ignore"}, ], }
Extend the response_actions configuration to:
def custom_action(response): # Custom logic here return response # ... { "path": "issues", "response_actions": [ {"status_code": 404, "action": custom_action}, ], }
def custom_action(response): # Custom logic here return response # ... { "path": "issues", "response_actions": [ custom_action, ], }
def custom_action_1(response): # Custom logic here return response def custom_action_2(response): # Custom logic here return response def custom_action_3(response): # Custom logic here return response # ... { "path": "issues", "response_actions": [ custom_action_1, custom_action_2 ], } { "path": "issues", "response_actions": [ custom_action_1, {"status_code": 200, "action": custom_action_2 } ], } { "path": "issues", "response_actions": [ custom_action_1, {"status_code": 200, "action": [custom_action_2, custom_action_3] } ], }
source/rest_api/config_setup.py
Background
Currently, the
response_actions
configuration within the REST API source only supports basic string actions like "ignore".Proposal
Extend the
response_actions
configuration to:Task
source/rest_api/config_setup.py
to accept hook functions as actions