1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-15 23:17:19 +00:00

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>
This commit is contained in:
zeripath
2021-03-01 21:08:10 +00:00
committed by GitHub
parent 59fd641d1f
commit f0e15250b9
77 changed files with 264 additions and 82 deletions

View File

@@ -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"],