Skip to content

Commit eb238c0

Browse files
committed
Refactor codebase a bit
1 parent 0b1fb03 commit eb238c0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/server/balancer/utils.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,12 @@ function _sendSockJsInfo(req, res, cookies) {
103103
}
104104

105105
var endpointHash = Cluster.discovery.endpointToHash(endpoint);
106-
// when no balancer url is provided, using endpoint's absolute path instead of relative path
106+
// when no balancer url is provided,
107+
// using endpoint's absolute path instead of relative path
107108
var balancer = Cluster.discovery.pickBalancer(endpointHash) || endpoint || "";
108-
if (!/(\w+)\/$/.test(balancer)) balancer += '/'; // add tail backslash if path not end with it
109+
// add tail backslash if path not end with it
110+
balancer = (/\/$/).test(balancer)? balancer : balancer + '/';
111+
109112
var base_url =
110113
urlResolve(balancer, "cluster-ddp/" + endpointHash + "/" + serviceName);
111114

0 commit comments

Comments
 (0)