-
Notifications
You must be signed in to change notification settings - Fork 102
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 in method setting for webhooks #341
Add in method setting for webhooks #341
Conversation
9b72595
to
da78f58
Compare
Sorry for the extra force, after a bit more time to think on it I wasn't quite happy with my handling of getHttpMethod, I'm still quite, getEndpointPath only returns the first instance of the output it finds in the logs, this leads to only finding the first method set. Due to the promise required outputs() from AwsConstruct I can't just return this.methods.join(', ') nor can I use the stack output due to it only returning the first instance I'd very happily get your opinion on hows best to handle this |
Can the method be a single option, instead of an array? I think that would simplify the PR a lot, and would cover most use cases? |
da78f58
to
9aad291
Compare
Yep that'd make a lot of sense, I've just got those changes pushed up |
@fredericbarthelet WDYT? |
@mnapoli Sorry for the nudge but is there anything else I need to do to get this one merged in? |
I'd like to get @fredericbarthelet's opinion on this. I think this PR makes sense. In any case we'd need tests to cover the new feature. |
src/constructs/aws/Webhook.ts
Outdated
@@ -28,12 +28,14 @@ const WEBHOOK_DEFINITION = { | |||
insecure: { type: "boolean" }, | |||
path: { type: "string" }, | |||
eventType: { type: "string" }, | |||
method: { type: "string" }, |
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'd be a bit more precise here, in order to avoid HTTP verbs without body - API Gateway would not throw an error for a GET
method, but integration with Eventbridge would crash as no body payload would be accessible :
method: { type: "string" }, | |
method: { enum: ["POST", "PUT", "PATCH"] }, |
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.
My latest changes have switched over to 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.
LGTM :) Thanks @SludgeGirl !
Could you update the documentation at
Line 69 in 1e786ed
## Configuration reference |
Once added, we'll be merging this feature !
9aad291
to
aa7931e
Compare
I've rebased everything, added in the changes to the docs and unit tests. Let me know if you want anything further done! |
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'll let @fredericbarthelet review and approve
Thanks for your contribution @SludgeGirl :) ! Will be releasing a new Lift version right away for you to be able tu use this feature. |
Some webhooks utilise PUT instead of strictly POST, in order to support them I've added in the ability to specify which method the webhook should allow in order to allow for these cases
Let me know if you want any changes to this, it's my first time touching the project so suggestions are more than welcome