refactor: Fix empty input value handling in TextComponent and WebhookComponent

This commit is contained in:
ogabrielluiz 2024-06-14 15:05:06 -03:00
commit 05c2a59928
3 changed files with 3 additions and 2 deletions

View file

@ -36,6 +36,8 @@ class TextComponent(Component):
# meaning, if text_key = "bacon", then data_template = "{bacon}"
data_template = "{" + input_value.text_key + "}"
input_value = data_to_text(template=data_template, data=input_value)
elif not input_value:
input_value = ""
self.status = input_value
if not input_value:
input_value = ""

View file

@ -34,6 +34,6 @@ class WebhookComponent(CustomComponent):
message = f"Invalid JSON payload. Please check the format.\n\n{data}"
record = Data(data=body)
if not message:
message = json.dumps(body, indent=2)
message = record
self.status = message
return record

View file

@ -162,4 +162,3 @@ class Component(CustomComponent):
return [field.name for field in inputs]
except KeyError:
return []
return []