Answer the question
In order to leave comments, you need to log in
It's not clear how to pass the API key, axios library?
The data is the same, but in the case of axios it returns the wrong key. Why is that? help me please
axios({
method: 'post',
url: URL + 'get_products',
data: {
secret: secret
}
})
.then(data=>console.log(data))
.catch(err=>console.log(err))
HttpRequest.post(URL + 'get_products', { form: { secret: secret } }, function (err, res, body) {
if (err) {
return console.error('upload failed:', err);
}
else {
let data = JSON.parse(body);
console.log('======================================\n', data.name[0]);
}
})
Answer the question
In order to leave comments, you need to log in
Maybe Trouble in the headers?
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
Axios
key: secret
HttpRequest
secret: secret
You name the parameter differently
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question