Я не уверен, что заголовок или тело настроены неправильно. Любые мысли о том, чтобы изменить заголовки или, возможно, неправильно настроено тело?
const axios = require('axios');
const url = '/my_url';
const auth = {
username: username,
password: password
};
const requestbody = {
To: 'phone',
From: 'phone 2'
};
const headers = {
'Content-Type': 'application/x-www-form-urlencoded',
}
const config = {
auth: auth,
headers: headers
}
try {
const response = await axios.post(url, {data: requestbody}, config);
console.log(response);
} catch (error) {
console.error(error);
}
Ошибка типа: message: 'Missing required parameter To in the post body'