Skip to content
Myr

Use http-errors for res.format error

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

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 5855339 · Browse files · 3 files+6 added−4 removed
This commit

State

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

Diff stats

3 files+6 added−4 removed

  • other:+6 added−4 removed

3 files+6 added−4 removed

modified:lib/response.js+4 added-4 removed
12 unmodified lines
13 */1415var Buffer = require('safe-buffer').Buffer16var contentDisposition = require('content-disposition');17var createError = require('http-errors')18var deprecate = require('depd')('express');19var encodeUrl = require('encodeurl');20var escapeHtml = require('escape-html');21var http = require('http');
677 unmodified lines
699 obj[key](req, this, next);700 } else if (obj.default) {701 obj.default(req, this, next)702 } else {702 var err = new Error('Not Acceptable');703 err.status = err.statusCode = 406;704 err.types = normalizeTypes(keys).map(function(o){ return o.value });705 next(err);703 next(createError(406, {704 types: normalizeTypes(keys).map(function (o) { return o.value })705 }))706 }707708 return this;709};
460 unmodified lines
modified:History.md+1 added
6 unmodified lines
7 * Fix behavior of `null`/`undefined` as `maxAge` in `res.cookie`8 * Ignore `Object.prototype` values in settings through `app.set`/`app.get`9 * Invoke `default` with same arguments as types in `res.format`10 * Support proper 205 responses using `res.send`11 * Use `http-errors` for `res.format` error12 * deps: depd@2.0.013 - Replace internal `eval` usage with `Function` constructor14 - Use instance methods on `process` to check for listeners15 * deps: finalhandler@1.2.0
3539 unmodified lines
modified:package.json+1 added