-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add support for canned responses to VS/VSR #780
Conversation
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.
@Rulox thanks for the PR. good job!
I left a few suggestions regarding consistency and simplification. Let me know your thoughts.
Changed the validateSpecialVar to a switch case, with the next considerations:
I didn't create Let me know what you think thanks |
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.
@Rulox thank for the update.
Please see a few comments below. Additionally, there is a bug. sorry, only noticed that during this review.
Changed the validateSpecialVar to a switch case, with the next considerations:
I didn't create isValidSpecialVariableCookie or isValidSpecialArgument because those would have been just wrappers to isCookieName and isArgumentName so I think that would be just a waste of time and add code for nothing.
the switch looks good along with using the existing functions.
isValidSpecialVariableHeader is needed but there's a difference between using - and _. Creating a new regexp for this is against DRY and KISS, reusing the header with replacing the underscores seems a much better and elegant solution to me.
creating a new function is against DRY but not KISS. I left a comment for the corresponding line explaining why.
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.
@Rulox please my comments and suggestions
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.
👍
ff1b794
to
d041172
Compare
Proposed changes
This PR adds the "canned responses" features.
Now, it is possible to return preconfigured responses for any VS or VSR with the action
return
.Also refactored the
redirect
action to reuse the same code as the newreturn
action, as both make usage of the "return" directive from NGINX.