forwardemail / forwardemail/superagent

On Timeout with Post request timeoutError is not getting called

Open
#964 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
16.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Hello Friends,

While doing post request with timeout, I couldnt able to get timeoutError. Please find the code snippet as below:

`request.post('https://localhost/api)
.timeout(500)
.set('Content-Type', 'application/json')
.send(data)
.end(function(err, res) {
console.log('********res.status******' + res.status);
console.log('********res.type******' + res.statusType);
if(err && err.timeout) {
console.log('********Error Timeout******');
}
});`

When there is no timeout from server, I can see the console logs (First two) but on timeout, I cannot see any console logs.

Even I tried below but no console logs on timeout:
`request.post('https://localhost/api)
.timeout(500)
.set('Content-Type', 'application/json')
.send(data)
.end(function(err, res) {
console.log('********res.status******' + res.status);
console.log('********res.type******' + res.statusType);
if(err && err.timeout) {
console.log('********Error Timeout******');
}
}).on('error', function(err) {
console.log('Under Error.....' );
});`

Can anyone please guide me how to call timeout for post request?

Regards,
Ankur.

Contributor guide

Open the contributing guide

Research direction

No file or test is named in the report. Start by reproducing the POST request with a 500ms timeout from the supplied snippet, then trace the timeout and callback/error entry points. Done means the timeout behavior is explained and a focused regression test verifies the expected error callback behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.