Skip to content

Commit

Permalink
docs: update the req.range jsdoc comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Jun 1, 2016
1 parent 7ee41cc commit f4f4902
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,26 +171,27 @@ req.acceptsLanguage = deprecate.function(req.acceptsLanguages,
'req.acceptsLanguage: Use acceptsLanguages instead');

/**
* Parse Range header field,
* capping to the given `size`.
* Parse Range header field, capping to the given `size`.
*
* Unspecified ranges such as "0-" require
* knowledge of your resource length. In
* the case of a byte range this is of course
* the total number of bytes. If the Range
* header field is not given `null` is returned,
* `-1` when unsatisfiable, `-2` when syntactically invalid.
* Unspecified ranges such as "0-" require knowledge of your resource length. In
* the case of a byte range this is of course the total number of bytes. If the
* Range header field is not given `undefined` is returned, `-1` when unsatisfiable,
* and `-2` when syntactically invalid.
*
* NOTE: remember that ranges are inclusive, so
* for example "Range: users=0-3" should respond
* with 4 users when available, not 3.
* When ranges are returned, the array has a "type" property which is the type of
* range that is required (most commonly, "bytes"). Each array element is an object
* with a "start" and "end" property for the portion of the range.
*
* @param {Number} size
* @return {Array}
* NOTE: remember that ranges are inclusive, so for example "Range: users=0-3"
* should respond with 4 users when available, not 3.
*
* @param {number} size
* @param {object} [options]
* @return {number|array}
* @public
*/

req.range = function(size){
req.range = function range(size) {
var range = this.get('Range');
if (!range) return;
return parseRange(size, range);
Expand Down

0 comments on commit f4f4902

Please sign in to comment.