-
Notifications
You must be signed in to change notification settings - Fork 27
[Feature] Adding webhookAddExtraHeaders for pdf builder classes. #248
Description
Is it possible to get an 'add extra headers' to the webhook request without overwriting the currently existing ones? That way you can, say, define an authorization header for the webhook in the config yaml, and then if there's info that needs to be passed to my webhook via headers, then that can be applied in a service without needing to pass in your auth string to your service.
Example config:
sensiolabs_gotenberg:
http_client: 'gotenberg.client'
webhook:
default:
extra_http_headers:
name: 'Authorization'
value: '%env(AuthPassword)%'
And in my service
public function myFunc(GotenbergPdfInterface $service)
{
...
$builder->webhookAddExtraHeaders(['X-MyVal-1' => 'foo', 'X-MyVal-2' => 'bar'])
...
}
and have the resulting header as:
Gotenberg-Webhook-Extra-Http-Headers: {"Authorization":"Bearer Blahblahblah","X-MyVal-1":"foo","X-MyVal-2":"bar"}
Right now having stuff in the config and calling $builder->webhookExtraHeaders() overwrites any of the existing webhook extra headers. This exists with regular extra http headers with $builder->extraHttpHeaders() and $builder->addExtraHttpHeaders() and just having that option for Webhook extra headers as well.
Thank You.