Skip to content

Commit

Permalink
Add arbitrary headers to a default destination (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
CKarper authored and olegsu committed Aug 11, 2019
1 parent 0eb14d6 commit d116aea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0
0.6.0
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 @@ -34,6 +35,9 @@ func (d *defaultDestination) Exec(payload interface{}) {
req.Header.Set("X-IRIS-HMAC", getHmac(d.Secret, mJSON))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("User-Agent", UserAgent)
for k, v := range d.Headers {
req.Header.Set(k, v)
}
client := &http.Client{}
client.Do(req)
}

0 comments on commit d116aea

Please sign in to comment.