Skip to content

Commit

Permalink
Make headers a map of strings
Browse files Browse the repository at this point in the history
Signed-off-by: Elis Lulja <[email protected]>
  • Loading branch information
asimpleidea committed Jan 10, 2021
1 parent cd65cb2 commit dea7278
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion page.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
4 changes: 3 additions & 1 deletion page_poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit dea7278

Please sign in to comment.