const http = require('http'); // 发送请求到Swagger UI const options = { hostname: 'admin.jiebanke.com', port: 3001, path: '/api-docs/', method: 'GET' }; const req = http.request(options, (res) => { console.log(`状态码: ${res.statusCode}`); res.on('data', (chunk) => { // 检查响应中是否包含Swagger UI的关键字 if (chunk.toString().includes('Swagger UI')) { console.log('Swagger UI 已成功启动并运行'); } else { console.log('收到响应,但可能不是Swagger UI页面'); } // 只输出前200个字符来检查内容 console.log('响应前200字符:', chunk.toString().substring(0, 200)); }); }); req.on('error', (error) => { console.error('请求出错:', error.message); }); req.end();