resmoio / kubernetes-event-exporter

Export Kubernetes events to multiple destinations with routing and filtering
Apache License 2.0
759 stars 149 forks source link

Unable to setup header for webhook in format of cloudevents due to hardcoded content-type application/json #138

Open wbaldowski-atos opened 10 months ago

wbaldowski-atos commented 10 months ago

Dear Source Code Maintainers.

I'm trying to to send webhook in cloudevents format to Azure Event Grid and I'm getting errors like: "HTTP Error 400. The request has an invalid header name."

For cloudevents specification, the required content-type is: application/cloudevents+json; charset=utf-8 However, for webhook we have hardcoded parameter application/json:

https://github.com/resmoio/kubernetes-event-exporter/blob/master/pkg/sinks/webhook.go line: 52 req.Header.Add("Content-Type", "application/json")

Is it possible to support custom content-type header for webhook? Many thanks for answer and help.

Best Regards. W.