/** * 响应重定向 * * @param {*} req * @param {*} res * @memberof StaticServer */ respondRedirect(req, res) { const location = req.url + '/'; res.writeHead(301, { 'Location': location, 'Content-Type': 'text/html' }); const html = _defaultTemplate({ htmlStr: `Redirecting to <a href='${location}'>${location}</a>`, showFileList: false }) res.end(html); }
'Content-Type': 'text/html' }); const html = _defaultTemplate({ requestPath, fileList,