[fix] timeout doesn't call end with error
pbatey opened this issue · comments
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
- I have searched through GitHub issues for similar issues.
- I have completely read through the README and documentation.
- I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.