Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Description
Description
Due to how the web hook component is setup it's not possible to change the HTTP response for the web hook request from its consumer. It's only possible to provide a custom but "static" response from the web hook request parser.
I know that the general use case for web hooks is to answer with empty200
or202
responses to indicate that the web hook has received the event, but it might be limiting depending on what the web hook caller may support.
We're usingtus/tusd connected to a Symfony backend using the web hook component for example and its web hook implementation allows to react on web hook responses that have a specific format. This is especially important if you want to communicate errors from the web hook call (permission, validation, etc.) throughtusd
back to the client.
Sure, we can just drop the web hook component for this use case and use a regular controller, but I might be tempted to think that the general use case of providing custom responses to a web hook caller from within the web hook consumer is probably a more common one.
Would something like that in general be a viable option for the web hook component?
To make it work we'd need to use an optional return value from the\Symfony\Component\RemoteEvent\Consumer\ConsumerInterface::consume
method and forward that return value through the message bus back to\Symfony\Component\Webhook\Controller\WebhookController::handle
. This will only work for synchronous executions of\Symfony\Component\RemoteEvent\Messenger\ConsumeRemoteEventHandler
however. I think this can be done in a BC way and can stay purely optional.
What do you think? If this is worth I try, I can provide a PR.
Example
No response