const axios = require('axios'); const qs = require('qs'); async function testEndpoint() { try { const data = { taskId: 1, targets: [{ targetType: 1, targetValue: 'kt66778899', displayName: '测试用户' }] }; console.log('Data to send:', JSON.stringify(data, null, 2)); const response = await axios.post('http://localhost:3000/directMessageTarget/test-batchAdd', qs.stringify(data), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }); console.log('Response:', response.data); } catch (error) { console.error('Error:', error.response?.data || error.message); } } testEndpoint();