27 lines
547 B
JavaScript
27 lines
547 B
JavaScript
const http = require('http');
|
|
|
|
const options = {
|
|
hostname: 'localhost',
|
|
port: 5352,
|
|
path: '/api/slaughter/slaughterhouses',
|
|
method: 'GET',
|
|
headers: {
|
|
'Authorization': 'Bearer mock-jwt-token-test',
|
|
'Content-Type': 'application/json'
|
|
}
|
|
};
|
|
|
|
const req = http.request(options, (res) => {
|
|
console.log(`状态码: ${res.statusCode}`);
|
|
console.log(`响应头: ${JSON.stringify(res.headers)}`);
|
|
|
|
res.on('data', (d) => {
|
|
process.stdout.write(d);
|
|
});
|
|
});
|
|
|
|
req.on('error', (error) => {
|
|
console.error(error);
|
|
});
|
|
|
|
req.end(); |