Skip to content
Myr

add inline range example

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 376b6c3 · Browse files · 1 file+19 added−0 removed
This commit

State

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

Diff stats

1 file+19 added−0 removed

  • other:+19 added−0 removed

1 file+19 added−0 removed

modified:lib/request.js+19 added
146 unmodified lines
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);155 *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 *169 *170 * @param {Number} size171 * @return {Array}172 * @api public173 */
303 unmodified lines