From a1ff189f72f38a1402828669cbdfa05a0946a3fc Mon Sep 17 00:00:00 2001 From: Patrick <dreamlike.sky@foxmail.com> Date: Sun, 15 Mar 2020 12:01:03 +0800 Subject: [PATCH] fix rest --- .../config_reader/reader_impl/default_config_reader.go | 4 ++-- protocol/rest/client/client_impl/resty_client.go | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/config/rest/config_reader/reader_impl/default_config_reader.go b/config/rest/config_reader/reader_impl/default_config_reader.go index 40e1ecf9a..89cf24748 100644 --- a/config/rest/config_reader/reader_impl/default_config_reader.go +++ b/config/rest/config_reader/reader_impl/default_config_reader.go @@ -18,8 +18,6 @@ package reader_impl import ( - "github.com/apache/dubbo-go/config/rest" - "github.com/apache/dubbo-go/config/rest/config_reader" "os" ) @@ -31,6 +29,8 @@ import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/yaml" + "github.com/apache/dubbo-go/config/rest" + "github.com/apache/dubbo-go/config/rest/config_reader" ) var ( diff --git a/protocol/rest/client/client_impl/resty_client.go b/protocol/rest/client/client_impl/resty_client.go index 839936695..aa6c23137 100644 --- a/protocol/rest/client/client_impl/resty_client.go +++ b/protocol/rest/client/client_impl/resty_client.go @@ -37,14 +37,14 @@ import ( ) func init() { - extension.SetRestClient(constant.DEFAULT_REST_CLIENT, GetRestyClient) + extension.SetRestClient(constant.DEFAULT_REST_CLIENT, NewRestyClient) } type RestyClient struct { client *resty.Client } -func NewRestyClient(restOption *client.RestOptions) *RestyClient { +func NewRestyClient(restOption *client.RestOptions) client.RestClient { client := resty.New() client.SetTransport( &http.Transport{ @@ -83,7 +83,3 @@ func (rc *RestyClient) Do(restRequest *client.RestRequest, res interface{}) erro } return nil } - -func GetRestyClient(restOptions *client.RestOptions) client.RestClient { - return NewRestyClient(restOptions) -} -- GitLab