Update environment info for http_function after execution using the data returned from isolator
This commit is contained in:
2
app.py
2
app.py
@@ -210,6 +210,8 @@ def execute_http_function(function):
|
||||
response = requests.post(API_URL, json={'code': code, 'request': request_obj, 'environment': environment})
|
||||
response_data = response.json()
|
||||
|
||||
db.update_http_function_environment_info(function, json.dumps(response_data['environment']))
|
||||
|
||||
# Map the Node.js response to Flask response
|
||||
flask_response = map_isolator_response_to_flask_response(response_data)
|
||||
return flask_response
|
||||
|
||||
4
db.py
4
db.py
@@ -63,6 +63,10 @@ class DataBase():
|
||||
def edit_http_function(self, name, script_content, environment_info):
|
||||
self.execute(
|
||||
'UPDATE http_functions SET script_content=%s, environment_info=%s WHERE NAME=%s', [script_content, environment_info, name], commit=True)
|
||||
|
||||
def update_http_function_environment_info(self, name, environment_info):
|
||||
self.execute(
|
||||
'UPDATE http_functions SET environment_info=%s WHERE NAME=%s', [environment_info, name], commit=True)
|
||||
|
||||
def delete_http_function(self, name):
|
||||
self.execute(
|
||||
|
||||
Reference in New Issue
Block a user