Skip to content
Myr

Add "options" argument to req.range

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 7fcf1d7 · Browse files · 3 files+22 added−5 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+22 added−5 removed

  • tests:+13 added−3 removed
  • other:+9 added−2 removed

3 files+22 added−5 removed

modified:lib/request.js+7 added-2 removed
180 unmodified lines
181 * When ranges are returned, the array has a "type" property which is the type of182 * range that is required (most commonly, "bytes"). Each array element is an object183 * with a "start" and "end" property for the portion of the range.184 *185 * The "combine" option can be set to `true` and overlapping & adjacent ranges186 * will be combined into a single range.187 *188 * NOTE: remember that ranges are inclusive, so for example "Range: users=0-3"189 * should respond with 4 users when available, not 3.190 *191 * @param {number} size192 * @param {object} [options]193 * @param {boolean} [options.combine=false]194 * @return {number|array}195 * @public196 */197193req.range = function range(size) {198req.range = function range(size, options) {199 var range = this.get('Range');200 if (!range) return;196 return parseRange(size, range);201 return parseRange(size, range, options);202};203204/**205 * Return the value of param `name` when present or `defaultValue`.
289 unmodified lines
modified:test/req.range.js+13 added-3 removed
modified:History.md+2 added
1unreleased2==========34 * Add `options` argument to `req.range`5 - Includes the `combine` option6 * Fix Windows absolute path check using forward slashes7 * Improve performance for `res.json`/`res.jsonp` in most cases8 * deps: accepts@~1.3.39 - Fix including type extensions in parameters in `Accept` parsing
3099 unmodified lines