Skip to content

Commit

Permalink
Add arbitrary headers to a default destination
Browse files Browse the repository at this point in the history
  • Loading branch information
CKarper committed Aug 9, 2019
1 parent 0a05c03 commit 3c04485
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/destination/default_destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type defaultDestination struct {
baseDestination `yaml:",inline"`
URL string `yaml:"url"`
Secret string `yaml:"secret"`
Headers map[string]string `yaml:"headers"`
}

func getHmac(secret string, payload []byte) string {
Expand All @@ -33,6 +34,9 @@ func (d *defaultDestination) Exec(payload interface{}) {
req, _ := http.NewRequest("POST", d.URL, contentReader)
req.Header.Set("X-IRIS-HMAC", getHmac(d.Secret, mJSON))
req.Header.Set("Content-Type", "application/json")
for k, v := range d.Headers {
req.Header.Set(k, v)
}
client := &http.Client{}
client.Do(req)
}

0 comments on commit 3c04485

Please sign in to comment.