diff options
author | Corey Hulen <corey@hulen.com> | 2015-10-28 14:45:08 -0700 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-10-28 14:45:08 -0700 |
commit | 5c03f3aad80ecf940ba9dab2321d504d51e9a0e5 (patch) | |
tree | e1f6ffcf2b8c290257f07a1413b576c7d99537a5 /api | |
parent | 5f2e01a93815f6a877b179d04e8f9e89ebd3077b (diff) | |
parent | 35d1ac80dd3f7d6b094c22e3454122aae3975d53 (diff) | |
download | chat-5c03f3aad80ecf940ba9dab2321d504d51e9a0e5.tar.gz chat-5c03f3aad80ecf940ba9dab2321d504d51e9a0e5.tar.bz2 chat-5c03f3aad80ecf940ba9dab2321d504d51e9a0e5.zip |
Merge pull request #1214 from mattermost/outgoing-hook-fix
Pass in iter vars to closures properly for outgoing webhooks
Diffstat (limited to 'api')
-rw-r--r-- | api/post.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/api/post.go b/api/post.go index b8588fe6a..c98bf2d71 100644 --- a/api/post.go +++ b/api/post.go @@ -249,7 +249,7 @@ func handleWebhookEventsAndForget(c *Context, post *model.Post, team *model.Team } for _, hook := range relevantHooks { - go func() { + go func(hook *model.OutgoingWebhook) { p := url.Values{} p.Set("token", hook.Token) @@ -270,7 +270,7 @@ func handleWebhookEventsAndForget(c *Context, post *model.Post, team *model.Team client := &http.Client{} for _, url := range hook.CallbackURLs { - go func() { + go func(url string) { req, _ := http.NewRequest("POST", url, strings.NewReader(p.Encode())) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") req.Header.Set("Accept", "application/json") @@ -289,10 +289,10 @@ func handleWebhookEventsAndForget(c *Context, post *model.Post, team *model.Team } } } - }() + }(url) } - }() + }(hook) } }() |