adding custom headers for remoteURL

This commit is contained in:
Julien Neuhart
2019-12-06 11:22:11 +01:00
parent 782f6ac27e
commit 927f98c66b
7 changed files with 71 additions and 39 deletions

View File

@@ -13,8 +13,8 @@ const (
WebhookURLCustomHeaderCanonicalBaseKey string = "Gotenberg-Webhookurl-"
)
func fetchCustomHeaders(r Resource, baseKey string) map[string][]string {
customHeaders := make(map[string][]string)
func fetchCustomHeaders(r Resource, baseKey string) map[string]string {
customHeaders := make(map[string]string)
for key, value := range r.customHeaders {
if strings.Contains(key, baseKey) {
realKey := strings.Replace(key, baseKey, "", 1)
@@ -26,12 +26,12 @@ func fetchCustomHeaders(r Resource, baseKey string) map[string][]string {
// RemoteURLCustomHeaders is a helper for retrieving
// the custom headers for the URL conversion.
func RemoteURLCustomHeaders(r Resource) map[string][]string {
func RemoteURLCustomHeaders(r Resource) map[string]string {
return fetchCustomHeaders(r, RemoteURLCustomHeaderCanonicalBaseKey)
}
// WebhookURLCustomHeaders is a helper for retrieving
// the custom headers for the webhook URL.
func WebhookURLCustomHeaders(r Resource) map[string][]string {
func WebhookURLCustomHeaders(r Resource) map[string]string {
return fetchCustomHeaders(r, WebhookURLCustomHeaderCanonicalBaseKey)
}