aboutsummaryrefslogtreecommitdiff
path: root/models/webhook.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/webhook.go')
-rw-r--r--models/webhook.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/models/webhook.go b/models/webhook.go
index ca2ee588..59a1962a 100644
--- a/models/webhook.go
+++ b/models/webhook.go
@@ -9,13 +9,13 @@ import (
"crypto/sha256"
"crypto/tls"
"encoding/hex"
- "encoding/json"
"fmt"
"io/ioutil"
"strings"
"time"
"github.com/go-xorm/xorm"
+ "github.com/json-iterator/go"
gouuid "github.com/satori/go.uuid"
log "gopkg.in/clog.v1"
@@ -126,7 +126,7 @@ func (w *Webhook) AfterSet(colName string, _ xorm.Cell) {
switch colName {
case "events":
w.HookEvent = &HookEvent{}
- if err = json.Unmarshal([]byte(w.Events), w.HookEvent); err != nil {
+ if err = jsoniter.Unmarshal([]byte(w.Events), w.HookEvent); err != nil {
log.Error(3, "Unmarshal [%d]: %v", w.ID, err)
}
case "created_unix":
@@ -138,7 +138,7 @@ func (w *Webhook) AfterSet(colName string, _ xorm.Cell) {
func (w *Webhook) GetSlackHook() *SlackMeta {
s := &SlackMeta{}
- if err := json.Unmarshal([]byte(w.Meta), s); err != nil {
+ if err := jsoniter.Unmarshal([]byte(w.Meta), s); err != nil {
log.Error(2, "GetSlackHook [%d]: %v", w.ID, err)
}
return s
@@ -151,7 +151,7 @@ func (w *Webhook) History(page int) ([]*HookTask, error) {
// UpdateEvent handles conversion from HookEvent to Events.
func (w *Webhook) UpdateEvent() error {
- data, err := json.Marshal(w.HookEvent)
+ data, err := jsoniter.Marshal(w.HookEvent)
w.Events = string(data)
return err
}
@@ -456,7 +456,7 @@ func (t *HookTask) AfterSet(colName string, _ xorm.Cell) {
}
t.RequestInfo = &HookRequest{}
- if err = json.Unmarshal([]byte(t.RequestContent), t.RequestInfo); err != nil {
+ if err = jsoniter.Unmarshal([]byte(t.RequestContent), t.RequestInfo); err != nil {
log.Error(3, "Unmarshal[%d]: %v", t.ID, err)
}
@@ -466,14 +466,14 @@ func (t *HookTask) AfterSet(colName string, _ xorm.Cell) {
}
t.ResponseInfo = &HookResponse{}
- if err = json.Unmarshal([]byte(t.ResponseContent), t.ResponseInfo); err != nil {
+ if err = jsoniter.Unmarshal([]byte(t.ResponseContent), t.ResponseInfo); err != nil {
log.Error(3, "Unmarshal [%d]: %v", t.ID, err)
}
}
}
func (t *HookTask) MarshalJSON(v interface{}) string {
- p, err := json.Marshal(v)
+ p, err := jsoniter.Marshal(v)
if err != nil {
log.Error(3, "Marshal [%d]: %v", t.ID, err)
}