From 14d1dec45dd32928a940d4fcea1a2e2b81c56769 Mon Sep 17 00:00:00 2001 From: Ulric Qin Date: Fri, 27 Mar 2020 14:17:41 +0800 Subject: [PATCH 1/2] use ShouldBindJSON not ShouldBind when receive data --- src/modules/collector/http/routes/api_router.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/collector/http/routes/api_router.go b/src/modules/collector/http/routes/api_router.go index 925cd3b4..0066f103 100644 --- a/src/modules/collector/http/routes/api_router.go +++ b/src/modules/collector/http/routes/api_router.go @@ -38,7 +38,7 @@ func pushData(c *gin.Context) { recvMetricValues := []*dataobj.MetricValue{} metricValues := []*dataobj.MetricValue{} - errors.Dangerous(c.ShouldBind(&recvMetricValues)) + errors.Dangerous(c.ShouldBindJSON(&recvMetricValues)) var msg string for _, v := range recvMetricValues { From 484480348b9e7da3c05fc850866335d53f8f9bca Mon Sep 17 00:00:00 2001 From: Ulric Qin Date: Fri, 27 Mar 2020 14:18:40 +0800 Subject: [PATCH 2/2] use ShouldBindJSON not ShouldBind --- src/modules/transfer/http/routes/push_router.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/transfer/http/routes/push_router.go b/src/modules/transfer/http/routes/push_router.go index 226c657d..9a5ef222 100644 --- a/src/modules/transfer/http/routes/push_router.go +++ b/src/modules/transfer/http/routes/push_router.go @@ -21,7 +21,7 @@ func PushData(c *gin.Context) { recvMetricValues := []*dataobj.MetricValue{} metricValues := []*dataobj.MetricValue{} - errors.Dangerous(c.ShouldBind(&recvMetricValues)) + errors.Dangerous(c.ShouldBindJSON(&recvMetricValues)) var msg string for _, v := range recvMetricValues {