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
644 B
32 lines
644 B
|
3 months ago
|
const http = require('http');
|
||
|
|
|
||
|
|
function testMarketDetail() {
|
||
|
|
console.log('测试获取品种详情...');
|
||
|
|
|
||
|
|
const options = {
|
||
|
|
hostname: 'localhost',
|
||
|
|
port: 3007,
|
||
|
|
path: '/api/market/detail/AU',
|
||
|
|
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();
|
||
|
|
}
|
||
|
|
|
||
|
|
testMarketDetail();
|