1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

remove duplicate entry when request path is empty

This commit is contained in:
fangjian0423 2018-12-18 23:00:55 +08:00
parent ba101f479e
commit 46e4d71b22

View File

@ -62,11 +62,17 @@ public class SentinelProtectInterceptor implements ClientHttpRequestInterceptor
String hostResource = uri.getScheme() + "://" + uri.getHost()
+ (uri.getPort() == -1 ? "" : ":" + uri.getPort());
String hostWithPathResource = hostResource + uri.getPath();
boolean entryWithPath = true;
if (hostResource.equals(hostWithPathResource)) {
entryWithPath = false;
}
Entry hostEntry = null, hostWithPathEntry = null;
ClientHttpResponse response;
try {
ContextUtil.enter(hostWithPathResource);
hostWithPathEntry = SphU.entry(hostWithPathResource);
ContextUtil.enter(hostResource);
if (entryWithPath) {
hostWithPathEntry = SphU.entry(hostWithPathResource);
}
hostEntry = SphU.entry(hostResource);
response = execution.execute(request, body);
}