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 {
for key, rc := range restConsumerConfig.RestServiceConfigsMap {
rc.Client = getNotEmptyStr(rc.Client, restConsumerConfig.Client, constant.DEFAULT_REST_CLIENT)
rc.RestMethodConfigsMap = initMethodConfigMap(rc, restConsumerConfig.Consumes, restConsumerConfig.Produces)
restConsumerServiceConfigMap[strings.TrimPrefix(key, "/")] = rc
restConsumerServiceConfigMap[key] = rc
}
config.SetRestConsumerServiceConfigMap(restConsumerServiceConfigMap)
return nil
......@@ -79,7 +79,7 @@ func (cr *RestConfigReader) ReadProviderConfig(reader *bytes.Buffer) error {
for key, rc := range restProviderConfig.RestServiceConfigsMap {
rc.Server = getNotEmptyStr(rc.Server, restProviderConfig.Server, constant.DEFAULT_REST_SERVER)
rc.RestMethodConfigsMap = initMethodConfigMap(rc, restProviderConfig.Consumes, restProviderConfig.Produces)
restProviderServiceConfigMap[strings.TrimPrefix(key, "/")] = rc
restProviderServiceConfigMap[key] = rc
}
config.SetRestProviderServiceConfigMap(restProviderServiceConfigMap)
return nil
......
......@@ -123,13 +123,13 @@ func (c *RestMethodConfig) UnmarshalYAML(unmarshal func(interface{}) error) erro
}
// nolint
func GetRestConsumerServiceConfig(path string) *RestServiceConfig {
return restConsumerServiceConfigMap[path]
func GetRestConsumerServiceConfig(id string) *RestServiceConfig {
return restConsumerServiceConfigMap[id]
}
// nolint
func GetRestProviderServiceConfig(path string) *RestServiceConfig {
return restProviderServiceConfigMap[path]
func GetRestProviderServiceConfig(id string) *RestServiceConfig {
return restProviderServiceConfigMap[id]
}
// nolint
......
......@@ -44,7 +44,7 @@ const (
"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&" +
"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) {
......
......@@ -18,7 +18,6 @@
package rest
import (
"strings"
"sync"
"time"
)
......@@ -72,7 +71,8 @@ func (rp *RestProtocol) Export(invoker protocol.Invoker) protocol.Exporter {
url := invoker.GetUrl()
serviceKey := url.ServiceKey()
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 {
logger.Errorf("%s service doesn't has provider config", url.Path)
return nil
......@@ -94,7 +94,8 @@ func (rp *RestProtocol) Refer(url *common.URL) protocol.Invoker {
if t, err := time.ParseDuration(requestTimeoutStr); err == nil {
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 {
logger.Errorf("%s service doesn't has consumer config", url.Path)
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