You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
integrate bridge js transformations with webhook-receiver plugin (#933)
Updates the webhook-receiver plugin to accept a `TransformerTx` so it
can leverage the JS Runtime managed by bridge.
This is not the best diff, sadly.
The original webhook-ingester made some design decisions that made this
a little awkward. Specifically, the request would accept a forwarder on
its `forward` method which took responsibility for payload handling.
When transformations are optionally happening, the payload either needs
to transform as a part of the `forward` method, or (my preference) the
payload handling needs to be moved up to the handler level.
I went for the latter - The "forward" method now hangs off the forwarder
and receives a payload. This means the handler can attempt the
transformation before forwarding, which keeps the go/no-go logic all
within the handler body. It also avoids having to somehow pass app state
down into the forwarder so it could perform the transformation itself.
Unfortunately, the go/no-go logic in the handler is also sort of a mess.
In order to tame the additional mess contributed by the transformation,
that chunk of the work has been extracted into a helper function.
---
Ideally, we'd have some actual unit tests around the HTTP handler code,
and the bits invoked by it, but since we don't yet have anything setup
it'd be a bigger lift than I care to tackle right now.
Instead, manual testing was done, noted in the comments below.
0 commit comments