-
Notifications
You must be signed in to change notification settings - Fork 170
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
[THREESCALE-3189] Add maintenance policy #1105
Conversation
d2d309d
to
f0cb126
Compare
|
||
if configuration then | ||
policy.status_code = tonumber(configuration.status) or policy.status_code | ||
policy.message = configuration.message or policy.message |
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.
It might be useful to also set some header in case this is active. So you can have the payload as JSON for example.
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.
Not sure what you mean by setting a header here.
Do you mean returning JSON or plain text according to the value of the Accept
header of the request?
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 mean setting also Content-Type header when the policy is active. JSON payload is incorrect without proper Content-Type. And using two policies to activate mantenance mode would be weird.
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.
👍
This PR adds a new simple policy that allows users to reject incoming requests with a specified status code and message. It's useful for maintenance periods or to temporarily block an API.
This continues the work started by @alanmoran in #561
I used his commits, converted the policy to a builtin one (it was an example), and polished a few things and added some tests.