(req)
| 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) { |
no outgoing calls
no test coverage detected