Hello.
We are developing using Node.js.
But it's simpler than you think In the face of the problem, I left a question like this.
The code is approximately as follows:
What I want to do is call the sms function, and then the request function is called once more
I'd like to return the value of body that I receive as a print here.
I tried it myself, but undefined pops up.
How can we solve this problem?
After a little googling, I think there's an answer: Hand over the function to the factor and write logic there.
logic there."I tried it like this answer, but I couldn't return the value.
How can we address these issues?
const response = wait ms (content, body.tel);
function sms (content, recipient) {
const options = {
url: 'https://api-sms.cloud.toast.com/sms/v2.1/appKeys/key/sender/sms',
method: 'POST',
headers: headers,
body: JSON.stringify(data)
};
request(options).then((body) => {
console.log(body);
}).catch((err) => {
console.log(err);
});
}
I went in on the url
<StandardResponse>
<header>
<isSuccessful>false</isSuccessful>
<resultCode>-1000</resultCode>
<resultMessage>Invalid appKey.</resultMessage>
</header>
<body/>
</StandardResponse>
There's nothing on the body. That's why undefined appears.
async function sms(content, recipient){
const options = {
url: 'https://api-sms.cloud.toast.com/sms/v2.1/appKeys/key/sender/sms',
method: 'POST',
headers: headers,
body: JSON.stringify(data)
};
return await request(options);
}
926 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
585 PHP ssh2_scp_send fails to send files as intended
620 GDB gets version error when attempting to debug with the Presense SDK (IDE)
579 Understanding How to Configure Google API Key
577 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.