diff options
Diffstat (limited to 'modules/lfs/server.go')
-rw-r--r-- | modules/lfs/server.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/lfs/server.go b/modules/lfs/server.go index be21a4de82..45cba9d9b7 100644 --- a/modules/lfs/server.go +++ b/modules/lfs/server.go @@ -6,7 +6,6 @@ package lfs import ( "encoding/base64" - "encoding/json" "fmt" "io" "net/http" @@ -23,6 +22,7 @@ import ( "code.gitea.io/gitea/modules/storage" "github.com/dgrijalva/jwt-go" + jsoniter "github.com/json-iterator/go" ) const ( @@ -233,6 +233,7 @@ func getMetaHandler(ctx *context.Context) { ctx.Resp.Header().Set("Content-Type", metaMediaType) if ctx.Req.Method == "GET" { + json := jsoniter.ConfigCompatibleWithStandardLibrary enc := json.NewEncoder(ctx.Resp) if err := enc.Encode(Represent(rv, meta, true, false)); err != nil { log.Error("Failed to encode representation as json. Error: %v", err) @@ -304,6 +305,7 @@ func PostHandler(ctx *context.Context) { } ctx.Resp.WriteHeader(sentStatus) + json := jsoniter.ConfigCompatibleWithStandardLibrary enc := json.NewEncoder(ctx.Resp) if err := enc.Encode(Represent(rv, meta, meta.Existing, true)); err != nil { log.Error("Failed to encode representation as json. Error: %v", err) @@ -394,6 +396,7 @@ func BatchHandler(ctx *context.Context) { respobj := &BatchResponse{Objects: responseObjects} + json := jsoniter.ConfigCompatibleWithStandardLibrary enc := json.NewEncoder(ctx.Resp) if err := enc.Encode(respobj); err != nil { log.Error("Failed to encode representation as json. Error: %v", err) @@ -531,6 +534,7 @@ func unpack(ctx *context.Context) *RequestVars { var p RequestVars bodyReader := r.Body defer bodyReader.Close() + json := jsoniter.ConfigCompatibleWithStandardLibrary dec := json.NewDecoder(bodyReader) err := dec.Decode(&p) if err != nil { @@ -554,6 +558,7 @@ func unpackbatch(ctx *context.Context) *BatchVars { bodyReader := r.Body defer bodyReader.Close() + json := jsoniter.ConfigCompatibleWithStandardLibrary dec := json.NewDecoder(bodyReader) err := dec.Decode(&bv) if err != nil { |