forwardemail / forwardemail/supertest
[fix] timeout doesn't call end with error
- Dominant language
- JavaScript
- Stars
- 14.4k
- Forks
- 782
- PR merge metrics
- No merged PRs in 30d
Description
## Describe the bug
**Node.js version:** v18.14.1
**OS version:** macOS Ventura 13.1
**Description:** A request to a non-responsive route never times-out
## Actual behavior
The function passed to request(app).timeout(ms).end(fn) is never called.
## Expected behavior
I expected fn to be called with a timeout error.
## Code to reproduce
This never exits.
```
const request = require('supertest');
const assert = require('assert');
const express = require('express');
const app = express();
app.get('/user', function(req, res) {
// res.status(200).json({ name: 'john' });
});
request(app)
.get('/user')
.timeout({response: 100, deadline: 100})
.end(function(err, res) {
if (err) throw err;
});
```
## Checklist
- [X] I have searched through GitHub issues for similar issues.
- [X] I have completely read through the README and documentation.
- [X] I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.
Contributor guide
Research direction
Start by running the provided Express and Supertest reproduction with Node.js, then inspect the timeout and .end callback path involved in request(app).timeout(...). Add a regression test for a non-responsive route and verify that the callback receives a timeout error and the test exits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- express, javascript, node.js
- Domain
- backend, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100