Skip to content
Snippets Groups Projects
Commit cf2ffd47 authored by Patrick's avatar Patrick
Browse files

Merge remote-tracking branch 'upstream/1.5' into 1.5

parents 99ed78fb 004e1607
No related branches found
No related tags found
No related merge requests found
...@@ -62,7 +62,7 @@ func (cr *RestConfigReader) ReadConsumerConfig(reader *bytes.Buffer) error { ...@@ -62,7 +62,7 @@ func (cr *RestConfigReader) ReadConsumerConfig(reader *bytes.Buffer) error {
for key, rc := range restConsumerConfig.RestServiceConfigsMap { for key, rc := range restConsumerConfig.RestServiceConfigsMap {
rc.Client = getNotEmptyStr(rc.Client, restConsumerConfig.Client, constant.DEFAULT_REST_CLIENT) rc.Client = getNotEmptyStr(rc.Client, restConsumerConfig.Client, constant.DEFAULT_REST_CLIENT)
rc.RestMethodConfigsMap = initMethodConfigMap(rc, restConsumerConfig.Consumes, restConsumerConfig.Produces) rc.RestMethodConfigsMap = initMethodConfigMap(rc, restConsumerConfig.Consumes, restConsumerConfig.Produces)
restConsumerServiceConfigMap[strings.TrimPrefix(key, "/")] = rc restConsumerServiceConfigMap[key] = rc
} }
config.SetRestConsumerServiceConfigMap(restConsumerServiceConfigMap) config.SetRestConsumerServiceConfigMap(restConsumerServiceConfigMap)
return nil return nil
...@@ -79,7 +79,7 @@ func (cr *RestConfigReader) ReadProviderConfig(reader *bytes.Buffer) error { ...@@ -79,7 +79,7 @@ func (cr *RestConfigReader) ReadProviderConfig(reader *bytes.Buffer) error {
for key, rc := range restProviderConfig.RestServiceConfigsMap { for key, rc := range restProviderConfig.RestServiceConfigsMap {
rc.Server = getNotEmptyStr(rc.Server, restProviderConfig.Server, constant.DEFAULT_REST_SERVER) rc.Server = getNotEmptyStr(rc.Server, restProviderConfig.Server, constant.DEFAULT_REST_SERVER)
rc.RestMethodConfigsMap = initMethodConfigMap(rc, restProviderConfig.Consumes, restProviderConfig.Produces) rc.RestMethodConfigsMap = initMethodConfigMap(rc, restProviderConfig.Consumes, restProviderConfig.Produces)
restProviderServiceConfigMap[strings.TrimPrefix(key, "/")] = rc restProviderServiceConfigMap[key] = rc
} }
config.SetRestProviderServiceConfigMap(restProviderServiceConfigMap) config.SetRestProviderServiceConfigMap(restProviderServiceConfigMap)
return nil return nil
......
...@@ -123,13 +123,13 @@ func (c *RestMethodConfig) UnmarshalYAML(unmarshal func(interface{}) error) erro ...@@ -123,13 +123,13 @@ func (c *RestMethodConfig) UnmarshalYAML(unmarshal func(interface{}) error) erro
} }
// nolint // nolint
func GetRestConsumerServiceConfig(path string) *RestServiceConfig { func GetRestConsumerServiceConfig(id string) *RestServiceConfig {
return restConsumerServiceConfigMap[path] return restConsumerServiceConfigMap[id]
} }
// nolint // nolint
func GetRestProviderServiceConfig(path string) *RestServiceConfig { func GetRestProviderServiceConfig(id string) *RestServiceConfig {
return restProviderServiceConfigMap[path] return restProviderServiceConfigMap[id]
} }
// nolint // nolint
......
...@@ -44,7 +44,7 @@ const ( ...@@ -44,7 +44,7 @@ const (
"application=BDTService&category=providers&default.timeout=10000&dubbo=dubbo-provider-golang-1.0.0&" + "application=BDTService&category=providers&default.timeout=10000&dubbo=dubbo-provider-golang-1.0.0&" +
"environment=dev&interface=com.ikurento.user.UserProvider&ip=192.168.56.1&methods=GetUser%2C&" + "environment=dev&interface=com.ikurento.user.UserProvider&ip=192.168.56.1&methods=GetUser%2C&" +
"module=dubbogo+user-info+server&org=ikurento.com&owner=ZX&pid=1447&revision=0.0.1&" + "module=dubbogo+user-info+server&org=ikurento.com&owner=ZX&pid=1447&revision=0.0.1&" +
"side=provider&timeout=3000&timestamp=1556509797245" "side=provider&timeout=3000&timestamp=1556509797245&bean.name=com.ikurento.user.UserProvider"
) )
func TestRestInvokerInvoke(t *testing.T) { func TestRestInvokerInvoke(t *testing.T) {
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
package rest package rest
import ( import (
"strings"
"sync" "sync"
"time" "time"
) )
...@@ -72,7 +71,8 @@ func (rp *RestProtocol) Export(invoker protocol.Invoker) protocol.Exporter { ...@@ -72,7 +71,8 @@ func (rp *RestProtocol) Export(invoker protocol.Invoker) protocol.Exporter {
url := invoker.GetUrl() url := invoker.GetUrl()
serviceKey := url.ServiceKey() serviceKey := url.ServiceKey()
exporter := NewRestExporter(serviceKey, invoker, rp.ExporterMap()) exporter := NewRestExporter(serviceKey, invoker, rp.ExporterMap())
restServiceConfig := rest_config.GetRestProviderServiceConfig(strings.TrimPrefix(url.Path, "/")) id := url.GetParam(constant.BEAN_NAME_KEY, "")
restServiceConfig := rest_config.GetRestProviderServiceConfig(id)
if restServiceConfig == nil { if restServiceConfig == nil {
logger.Errorf("%s service doesn't has provider config", url.Path) logger.Errorf("%s service doesn't has provider config", url.Path)
return nil return nil
...@@ -94,7 +94,8 @@ func (rp *RestProtocol) Refer(url *common.URL) protocol.Invoker { ...@@ -94,7 +94,8 @@ func (rp *RestProtocol) Refer(url *common.URL) protocol.Invoker {
if t, err := time.ParseDuration(requestTimeoutStr); err == nil { if t, err := time.ParseDuration(requestTimeoutStr); err == nil {
requestTimeout = t requestTimeout = t
} }
restServiceConfig := rest_config.GetRestConsumerServiceConfig(strings.TrimPrefix(url.Path, "/")) id := url.GetParam(constant.BEAN_NAME_KEY, "")
restServiceConfig := rest_config.GetRestConsumerServiceConfig(id)
if restServiceConfig == nil { if restServiceConfig == nil {
logger.Errorf("%s service doesn't has consumer config", url.Path) logger.Errorf("%s service doesn't has consumer config", url.Path)
return nil return nil
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment