-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
interpolated response #1682
interpolated response #1682
Conversation
This looks like JSONPath, not Liquid. Can you not get that you need with Liquid? |
@cantino Excuse me, I thought of one thing and write another. |
@thiagotalma What is your use case here? I don't understand why JSONPath is required, as I see it Liquid should sufficient. We generally use JSONPath whenever an Agent needs to work with a hash or an array (like for the payload in this Agent) and Liquid when the output can be a string. |
In fact, I'm a problem that will end up coming to many people who try to use webhook with the Facebook API. The dot in the parameter name ruined my weekend! 😆 |
@thiagotalma I see, that is indeed a bit tricky, does |
@dsander But what is the context of interpolation? Example: {
"secret": "3b9661ffaecb41",
"expected_receive_period_in_days": 1,
"payload_path": ".",
"response": "{{ key }}",
"verbs": "post,get",
"code": "200"
} Request: Response: EMPTY |
See if [interpolated(params)['response'] || 'Event Created', code] |
If so, I think that'd be a reasonable change with a spec. |
[OFFTOPIC] I think the project needs a specific wiki to teach contributors the process of setting the environment and run the tests before opening a PR. I'm not the RoR world (i'm PHP) and take a whipping to get code something to help the project. A specific docker-compose for this would be perfect!! |
Right, I thought the interpolation context was already set. @thiagotalma The docker containers are running in the production environment, it's not possible to run the specs there. The Wiki has a few links on how to set up a local development environment: https://gist.github.com/mjhea0/b6b58eefc38985380ff9 and https://github.com/cantino/huginn/wiki/Novice-setup-guide |
thank you guys! (@dsander How about a docker-compose ready for development and testing? |
@@ -88,7 +88,7 @@ def receive_web_request(params, method, format) | |||
create_event(payload: payload) | |||
end | |||
|
|||
[response_message, code] | |||
[interpolated(params)['response'] || interpolated['response'] || 'Event Created', code] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need interpolated['response']
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To maintain compatibility with the current context... or not?
If you find it is not necessary, I remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need it. @dsander?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, we don't need it.
If we want to default to Event Created
when the interpolated result is an empty string interpolated(params)['response'].presence || 'Event Created'
would be an option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I wonder if we really want the ability to return an empty response body? I guess you should remove |
done! |
Thanks @thiagotalma! |
improve custom response with
liquidJSONPath