You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
647 B
32 lines
647 B
const http = require('http');
|
|
|
|
function testMarketOverview() {
|
|
console.log('测试获取市场概览...');
|
|
|
|
const options = {
|
|
hostname: 'localhost',
|
|
port: 3007,
|
|
path: '/api/market/overview',
|
|
method: 'GET'
|
|
};
|
|
|
|
const req = http.request(options, (res) => {
|
|
console.log(`状态码: ${res.statusCode}`);
|
|
res.setEncoding('utf8');
|
|
let data = '';
|
|
res.on('data', (chunk) => {
|
|
data += chunk;
|
|
});
|
|
res.on('end', () => {
|
|
console.log('响应数据:', data);
|
|
});
|
|
});
|
|
|
|
req.on('error', (e) => {
|
|
console.error(`请求失败: ${e.message}`);
|
|
});
|
|
|
|
req.end();
|
|
}
|
|
|
|
testMarketOverview(); |