node-webhooks icon indicating copy to clipboard operation
node-webhooks copied to clipboard

Url parameter interpolation feature

Open dankelleher opened this issue 7 years ago • 4 comments

Allows you to define webhooks like this:

webHooks.add('hook', URI + '/:id/abc')

and trigger like this:

webHooks.trigger('hook', {}, {}, { id: '123' })

dankelleher avatar Mar 19 '19 10:03 dankelleher

Coverage Status

Coverage increased (+0.2%) to 91.86% when pulling aaf82a132ea3e8caa24ecf689f3bef272b12e605 on civicteam:feature/url-parameter-interpolation into baf14131778e177657471d298d627f9ca978d929 on roccomuso:master.

coveralls avatar Mar 19 '19 10:03 coveralls

This will be a breaking change for current api. And also .trigger functions is getting too much params. We should consider a better approach

roccomuso avatar Mar 26 '19 12:03 roccomuso

I don't think it breaks the current API, does it? Unless you have colons in your URL. Then it might break alright.

How about a trigger() function that accepts (name, options) where options is an object of the form {body, headers, parameters}. This is roughly similar to how common http client libraries work, which is effectively what trigger() is anyway.

dankelleher avatar Mar 28 '19 19:03 dankelleher

it would be better, yep.

roccomuso avatar Apr 17 '19 00:04 roccomuso