diff --git a/common/nacos_server/nacos_server.go b/common/nacos_server/nacos_server.go index 7c003e65..b1a0c9b0 100644 --- a/common/nacos_server/nacos_server.go +++ b/common/nacos_server/nacos_server.go @@ -80,7 +80,11 @@ func (server *NacosServer) callConfigServer(api string, params map[string]string //headers["Accept-Encoding"] = []string{"gzip,deflate,sdch"} headers["Connection"] = []string{"Keep-Alive"} headers["exConfigInfo"] = []string{"true"} - headers["RequestId"] = []string{uuid.NewV4().String()} + uid, err := uuid.NewV4() + if err != nil { + return + } + headers["RequestId"] = []string{uid.String()} headers["Request-Module"] = []string{"Naming"} headers["Content-Type"] = []string{"application/x-www-form-urlencoded;charset=utf-8"} headers["Spas-AccessKey"] = []string{newHeaders["accessKey"]} @@ -119,7 +123,11 @@ func (server *NacosServer) callServer(api string, params map[string]string, meth headers["User-Agent"] = []string{constant.CLIENT_VERSION} //headers["Accept-Encoding"] = []string{"gzip,deflate,sdch"} headers["Connection"] = []string{"Keep-Alive"} - headers["RequestId"] = []string{uuid.NewV4().String()} + uid, err := uuid.NewV4() + if err != nil { + return + } + headers["RequestId"] = []string{uid.String()} headers["Request-Module"] = []string{"Naming"} headers["Content-Type"] = []string{"application/x-www-form-urlencoded;charset=utf-8"} diff --git a/go.mod b/go.mod index 32cf9d7f..e2c52631 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042 // indirect github.com/pkg/errors v0.9.1 - github.com/satori/go.uuid v1.2.0 + github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b github.com/stretchr/testify v1.5.1 github.com/tebeka/strftime v0.1.3 // indirect github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3 diff --git a/go.sum b/go.sum index 905893a9..7cce5e87 100644 --- a/go.sum +++ b/go.sum @@ -41,6 +41,7 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs=