From dea72780fb3593346f35c09b8f0ff14e5fc11528 Mon Sep 17 00:00:00 2001 From: Elis Lulja Date: Sun, 10 Jan 2021 12:38:29 +0100 Subject: [PATCH] Make headers a map of strings Signed-off-by: Elis Lulja --- page.go | 2 +- page_poller.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/page.go b/page.go index 4f104cc..0b1d3c8 100644 --- a/page.go +++ b/page.go @@ -12,7 +12,7 @@ type Page struct { // Method of the request, e.g.: GET Method *string `yaml:"method,omitempty"` // Headers to send with the request - Headers map[string][]string `yaml:"headers,omitempty"` + Headers map[string]string `yaml:"headers,omitempty"` // UserAgentOptions contains options about the // user agent *UserAgentOptions `yaml:"userAgentOptions,omitempty"` diff --git a/page_poller.go b/page_poller.go index 3d7bd97..eb7f328 100644 --- a/page_poller.go +++ b/page_poller.go @@ -78,7 +78,9 @@ func New(p *Page) (Poller, error) { if p.Headers == nil { l.Warn().Msg("no headers provided") } else { - headers = p.Headers + for headerKey, headerVal := range p.Headers { + headers[headerKey] = []string{headerVal} + } switch hlen := len(p.Headers); { case hlen == 0: l.Warn().Msg("no headers provided")