mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 00:19:48 +01:00
parent
869ddd775c
commit
b326ae89df
|
|
@ -1,6 +1,7 @@
|
|||
unreleased
|
||||
==========
|
||||
|
||||
* Fix `res.sendFile` logging standard write errors
|
||||
* deps: etag@~1.5.1
|
||||
* deps: proxy-addr@~1.0.4
|
||||
- deps: ipaddr.js@0.1.5
|
||||
|
|
|
|||
|
|
@ -398,8 +398,8 @@ res.sendFile = function sendFile(path, options, fn) {
|
|||
if (fn) return fn(err);
|
||||
if (err && err.code === 'EISDIR') return next();
|
||||
|
||||
// next() all but aborted errors
|
||||
if (err && err.code !== 'ECONNABORT') {
|
||||
// next() all but write errors
|
||||
if (err && err.code !== 'ECONNABORT' && err.syscall !== 'write') {
|
||||
next(err);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -69,6 +69,27 @@ describe('res', function(){
|
|||
.end(done);
|
||||
})
|
||||
|
||||
it('should not error if the client aborts', function (done) {
|
||||
var cb = after(1, done);
|
||||
var app = express();
|
||||
|
||||
app.use(function (req, res) {
|
||||
setImmediate(function () {
|
||||
res.sendFile(path.resolve(fixtures, 'name.txt'));
|
||||
cb();
|
||||
});
|
||||
test.abort();
|
||||
});
|
||||
|
||||
app.use(function (err, req, res, next) {
|
||||
err.code.should.be.empty;
|
||||
cb();
|
||||
});
|
||||
|
||||
var test = request(app).get('/');
|
||||
test.expect(200, cb);
|
||||
})
|
||||
|
||||
describe('with "dotfiles" option', function () {
|
||||
it('should not serve dotfiles by default', function (done) {
|
||||
var app = createApp(path.resolve(__dirname, 'fixtures/.name'));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user