This is an automated email from the ASF dual-hosted git repository.
hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks-controller.git
The following commit(s) were added to refs/heads/unstable by this push:
new c5ccf65 Fix should use json.Unmarshal instead of gin.BindJSON (#196)
c5ccf65 is described below
commit c5ccf65b59f0748fd2dc2ca3b4be3083e7056e04
Author: hulk <[email protected]>
AuthorDate: Sat Jul 20 14:18:06 2024 +0800
Fix should use json.Unmarshal instead of gin.BindJSON (#196)
---
cmd/client/main.go | 2 --
server/api/shard.go | 3 ++-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/cmd/client/main.go b/cmd/client/main.go
index 214cd65..bddb539 100644
--- a/cmd/client/main.go
+++ b/cmd/client/main.go
@@ -21,7 +21,6 @@
package main
import (
- "fmt"
"os"
"github.com/fatih/color"
@@ -35,7 +34,6 @@ var rootCommand = &cobra.Command{
Use: "kvctl",
Short: "kvctl is a command line tool for the Kvrocks controller
service",
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println(cmd.PersistentFlags().GetString("host"))
_, _ = color.New(color.Bold).Println("Run 'kvctl --help' for
usage.")
os.Exit(0)
},
diff --git a/server/api/shard.go b/server/api/shard.go
index ff673c8..6af2fdf 100644
--- a/server/api/shard.go
+++ b/server/api/shard.go
@@ -20,6 +20,7 @@
package api
import (
+ "encoding/json"
"errors"
"io"
"strconv"
@@ -128,7 +129,7 @@ func (handler *ShardHandler) Failover(c *gin.Context) {
return
}
if len(body) > 0 {
- if err := c.BindJSON(&req); err != nil {
+ if err := json.Unmarshal(body, &req); err != nil {
helper.ResponseBadRequest(c, err)
return
}