You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No it doesn't solve the problem.
The template replacement in the requester does not produce valid JSON.
Feature: Replace value with JSON via template
The requester doesn't properly replace values that contain JSON via template.
Scenario: Replace field in requester
Given a requester rule with the following configuration for the json parameter:
json:
field: ${<Value>}
When running the processor with an event matching the rule
Then the result of the _template method is <Result>
Examples:
| Value | Result |
| {"foo": "bar"} | "{'foo': 'bar'}" |
| "foo_bar" | "foo_bar" |
The result "{'foo': 'bar'}" is then loaded as json (json.loads(<Result>)).
However, this is not valid JSON, so it fails.
The problem are the single quotes. ast_eval is able to parse this as json.
The requester can send JSON data and it is able to reference data from the event:
This works as expected if
message
is a string.However, the reference is not converted into valid JSON if the referenced data from the event is a dict:
some_dict = {"foo": "bar"}
is converted to"{'foo': 'bar'}"
. This string can not be parsed to JSON without preprocessing it or usingast_eval
.Do you think this could be changed so that dict references are sent as valid JSON?
The text was updated successfully, but these errors were encountered: