adding PHP example for custom HTTP headers in documentation + improving logs for custom HTTP headers

This commit is contained in:
Julien Neuhart
2019-12-09 16:50:08 +01:00
parent 2251267ae4
commit 126cdd73e4
16 changed files with 133 additions and 95 deletions

View File

@@ -5,15 +5,15 @@ import (
)
const (
// RemoteURLCustomHeaderCanonicalBaseKey is the base key
// RemoteURLCustomHTTPHeaderCanonicalBaseKey is the base key
// of custom headers send to the remote URL.
RemoteURLCustomHeaderCanonicalBaseKey string = "Gotenberg-Remoteurl-"
// WebhookURLCustomHeaderCanonicalBaseKey is the base key
RemoteURLCustomHTTPHeaderCanonicalBaseKey string = "Gotenberg-Remoteurl-"
// WebhookURLCustomHTTPHeaderCanonicalBaseKey is the base key
// of custom headers send to the webhook URL.
WebhookURLCustomHeaderCanonicalBaseKey string = "Gotenberg-Webhookurl-"
WebhookURLCustomHTTPHeaderCanonicalBaseKey string = "Gotenberg-Webhookurl-"
)
func fetchCustomHeaders(r Resource, baseKey string) map[string]string {
func fetchCustomHTTPHeaders(r Resource, baseKey string) map[string]string {
customHeaders := make(map[string]string)
for key, value := range r.customHeaders {
if strings.Contains(key, baseKey) {
@@ -24,14 +24,14 @@ func fetchCustomHeaders(r Resource, baseKey string) map[string]string {
return customHeaders
}
// RemoteURLCustomHeaders is a helper for retrieving
// RemoteURLCustomHTTPHeaders is a helper for retrieving
// the custom headers for the URL conversion.
func RemoteURLCustomHeaders(r Resource) map[string]string {
return fetchCustomHeaders(r, RemoteURLCustomHeaderCanonicalBaseKey)
func RemoteURLCustomHTTPHeaders(r Resource) map[string]string {
return fetchCustomHTTPHeaders(r, RemoteURLCustomHTTPHeaderCanonicalBaseKey)
}
// WebhookURLCustomHeaders is a helper for retrieving
// WebhookURLCustomHTTPHeaders is a helper for retrieving
// the custom headers for the webhook URL.
func WebhookURLCustomHeaders(r Resource) map[string]string {
return fetchCustomHeaders(r, WebhookURLCustomHeaderCanonicalBaseKey)
func WebhookURLCustomHTTPHeaders(r Resource) map[string]string {
return fetchCustomHTTPHeaders(r, WebhookURLCustomHTTPHeaderCanonicalBaseKey)
}