summaryrefslogtreecommitdiffstats
path: root/models/webhook.go
diff options
context:
space:
mode:
authorViktor Szakats <vszakats@users.noreply.github.com>2019-10-20 13:41:24 +0200
committertechknowlogick <techknowlogick@gitea.io>2019-10-20 07:41:24 -0400
commitbcd96421dd7d06047578787cc0a6764843e2513b (patch)
tree14cd3033ac3e3b2b2e6cada20f89de6a1394eeb9 /models/webhook.go
parent3b379691fa2ccade5d536f17b6438cf5f8344fae (diff)
downloadgitea-bcd96421dd7d06047578787cc0a6764843e2513b.tar.gz
gitea-bcd96421dd7d06047578787cc0a6764843e2513b.zip
webhook: set Content-Type for application/x-www-form-urlencoded (#8599)
This header is missing since switching http client from GiteaServer (`code.gitea.io/gitea/modules/httplib`) to Go-http-client/1.1 (`net.http`). The header [was added by default](https://github.com/go-gitea/gitea/blob/release/v1.8/modules/httplib/httplib.go#L301) by the former, but this is no longer true with `net.http`, so it needs to be done explicitly: Ref: https://github.com/go-gitea/gitea/issues/7700
Diffstat (limited to 'models/webhook.go')
-rw-r--r--models/webhook.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/models/webhook.go b/models/webhook.go
index f657c18792..6f2162c799 100644
--- a/models/webhook.go
+++ b/models/webhook.go
@@ -833,6 +833,8 @@ func (t *HookTask) deliver() error {
return err
}
+
+ req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
}
case http.MethodGet:
u, err := url.Parse(t.URL)