14
15var contentDisposition = require('content-disposition');
16▶var createError = require('http-errors')
17var deprecate = require('depd')('express');
18var encodeUrl = require('encodeurl');
· · ·
54 *
55 * Expects an integer value between 100 and 999 inclusive.
56▶ * Throws an error if the provided status code is not an integer or if it's outside the allowable range.
57 *
58 * @param {number} code - The HTTP status code to set.
· · ·
59 * @return {ServerResponse} - Returns itself for chaining methods.
60▶ * @throws {TypeError} If `code` is not an integer.
61 * @throws {RangeError} If `code` is outside the range 100 to 999.
62 * @public
· · ·
61▶ * @throws {RangeError} If `code` is outside the range 100 to 999.
62 * @public
63 */
· · ·
66 // Check if the status code is not an integer
67 if (!Number.isInteger(code)) {
68▶ throw new TypeError(`Invalid status code: ${JSON.stringify(code)}. Status code must be an integer.`);
69 }
70 // Check if the status code is outside of Node's valid range
+ 18 more matches in this file