Skip to content
Myr

Fix Allow header for OPTIONS to not contain duplicate methods

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

fixes #2458

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 3387916 · Browse files · 3 files+26 added−1 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+26 added−1 removed

  • tests:+14 added−0 removed
  • other:+12 added−1 removed

3 files+26 added−1 removed

modified:lib/router/index.js+11 added-1 removed
205 unmodified lines
206 var has_method = route._handles_method(method);207208 // build up automatic options response209 if (!has_method && method === 'OPTIONS') {210 options.push.apply(options, route._options());210 appendMethods(options, route._options());211 }212213 // don't even bother214 if (!has_method && method !== 'HEAD') {
276 unmodified lines
491 return this;492 };493});494495// append methods to a list of methods496function appendMethods(list, addition) {497 for (var i = 0; i < addition.length; i++) {498 var method = addition[i];499 if (list.indexOf(method) === -1) {500 list.push(method);501 }502 }503}504505// get type for error message506function gettype(obj) {507 var type = typeof obj;508
78 unmodified lines
modified:test/app.options.js+14 added
modified:History.md+1 added
1unreleased2==========34 * Fix `Allow` header for `OPTIONS` to not contain duplicate methods5 * Fix incorrect "Request aborted" for `res.sendFile` when `HEAD` or 3046 * deps: debug@~2.1.17 * deps: finalhandler@0.3.38 - deps: debug@~2.1.1
2534 unmodified lines