Skip to content
Myr

update range-parser dep

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 619e634 · Browse files · 2 files+21 added−18 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+21 added−18 removed

  • other:+21 added−18 removed

2 files+21 added−18 removed

modified:lib/request.js+20 added-17 removed
139 unmodified lines
140 * Unspecified ranges such as "0-" require141 * knowledge of your resource length. In142 * the case of a byte range this is of course143 * the total number of bytes. If the Range144 * header field is not given `undefined` is returned,145 * on failure `null` is returned.144 * header field is not given `null` is returned,145 * `-1` when unsatisfiable, `-2` when syntactically invalid.146 *147 * NOTE: remember that ranges are inclusive, so148 * for example "Range: users=0-3" should respond149 * with 4 users when available, not 3.150 *151 * Examples:152 *153 * app.get('/users', function(req, res){154 * var range = req.range(users.length);153 * app.get('/users', function(req, res){154 * var range = req.range(users.length);155 * 156 * switch (range) {157 * // unsatifiable158 * case -1:159 * return res.send(416);160 * // invalid or no Range161 * case -2: 162 * case undefined:163 * return res.send(users);164 * // inclusive Range165 * default:166 * if ('users' != range.type) return res.send(416);167 * range = range.shift();168 * res.send(users.slice(range.start, ++range.end));169 * }170 * });171 *156 * // no range given157 * if (undefined === range) {158 * res.send(users);159 * // requested range not satisfiable160 * } else if (null === range || 'users' != range.type) {161 * return res.send(416);162 * // valid range163 * } else {164 * range = range.shift();165 * res.send(users.slice(range.start, ++range.end));166 * }167 * });168 *172 * @param {Number} size173 * @return {Array}174 * @api public175 */
303 unmodified lines
modified:package.json+1 added-1 removed