MCPcopy Index your code
hub / github.com/codecombat/codecombat / shouldRedirectToCountryServer

Function shouldRedirectToCountryServer

server_setup.js:117–121  ·  view source on GitHub ↗
(req)

Source from the content-addressed store, hash-verified

115 if (host == null) { host = 'cn.codecombat.com'; }
116 const hosts = host.split(/;/g);
117 const shouldRedirectToCountryServer = function(req) {
118 let left;
119 const reqHost = ((left = req.hostname != null ? req.hostname : req.host) != null ? left : '').toLowerCase(); // Work around express 3.0
120 return (req.country === country) && !Array.from(hosts).includes(reqHost) && (reqHost.indexOf(config.unsafeContentHostname) === -1);
121 };
122
123 return app.use(function(req, res, next) {
124 if (shouldRedirectToCountryServer(req) && hosts.length) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected