diff options
author | zeripath <art27@cantab.net> | 2021-03-01 21:08:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-01 22:08:10 +0100 |
commit | f0e15250b9e322cc7731ba026d12387c2b549a42 (patch) | |
tree | f13d46119077ba924d620ef172b91daa315bda0a /routers/api/v1/utils | |
parent | 59fd641d1fb021e35aea7f9f4a1916cc11ef5c51 (diff) | |
download | gitea-f0e15250b9e322cc7731ba026d12387c2b549a42.tar.gz gitea-f0e15250b9e322cc7731ba026d12387c2b549a42.zip |
Migrate to use jsoniter instead of encoding/json (#14841)
* Migrate to use jsoniter
* fix tests
* update gitea.com/go-chi/binding
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'routers/api/v1/utils')
-rw-r--r-- | routers/api/v1/utils/hook.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/routers/api/v1/utils/hook.go b/routers/api/v1/utils/hook.go index b0ce40b9fb..c7af40dcf0 100644 --- a/routers/api/v1/utils/hook.go +++ b/routers/api/v1/utils/hook.go @@ -5,7 +5,6 @@ package utils import ( - "encoding/json" "fmt" "net/http" "strings" @@ -17,6 +16,7 @@ import ( "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/routers/utils" "code.gitea.io/gitea/services/webhook" + jsoniter "github.com/json-iterator/go" ) // GetOrgHook get an organization's webhook. If there is an error, write to @@ -147,6 +147,7 @@ func addHook(ctx *context.APIContext, form *api.CreateHookOption, orgID, repoID return nil, false } + json := jsoniter.ConfigCompatibleWithStandardLibrary meta, err := json.Marshal(&webhook.SlackMeta{ Channel: strings.TrimSpace(channel), Username: form.Config["username"], @@ -221,6 +222,7 @@ func editHook(ctx *context.APIContext, form *api.EditHookOption, w *models.Webho if w.Type == models.SLACK { if channel, ok := form.Config["channel"]; ok { + json := jsoniter.ConfigCompatibleWithStandardLibrary meta, err := json.Marshal(&webhook.SlackMeta{ Channel: channel, Username: form.Config["username"], |