Skip to content
Myr

refactoring

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent a95a0ab · Browse files · 2 files+9 added−17 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+9 added−17 removed

  • tests:+2 added−2 removed
  • other:+7 added−15 removed

2 files+9 added−17 removed

modified:lib/response.js+7 added-15 removed
177 unmodified lines
178179 // callback180 options.callback = function(err){181 if (err) {182 // cast ENOENT183 if ('ENOENT' == err.code) err = 404;184185 // coerce numeric error to an Error186 if ('number' == typeof err) err = utils.error(err);187188 // ditch content-disposition to prevent funky responses189 if (!self.headerSent) self.removeHeader('Content-Disposition');190187 // forbidden188 if ('Forbidden' == err.message) {189 if (fn) return fn(err);190 return req.next(403);191 }191 // woot! callback available192 if (fn) return fn(err);193193 // not found194 if ('ENOENT' == err.code) {195 if (fn) return fn(err);196 return req.next(404);197 }198194 // lost in limbo if there's no callback200 if (self.headerSent) return fn && fn(err);195 if (self.headerSent) return;196202 // callback available203 if (fn) return fn(err);204197 return req.next(err);198 }199200 fn && fn();
356 unmodified lines
modified:test/res.sendfile.js+2 added-2 removed