Skip to content

[Feature] Adding webhookAddExtraHeaders for pdf builder classes. #248

@skoolecg

Description

@skoolecg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions