From 8e9265c4029885334a8dd5d7c55584bdbd2a0537 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 20 Oct 2019 19:18:05 +0200 Subject: [PATCH] webhook: set Content-Type for application/x-www-form-urlencoded (#8600) 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. Closes: #7700 --- models/webhook.go | 2 ++ 1 file changed, 2 insertions(+) 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)