Skip to content
Myr

request.js

This file

Path

lib/request.js

515 lines · 11.4 KiB · JavaScript

Last changed by

Merge tag '4.17.2'Douglas Christopher Wilsonbefore adoptionc7d528c

History of this file

Take it

The walk stopped after 200 commits: lines older than 2cb029f point at it.

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

lines 1–10why, one step back
1/*!
2 * express3 * Copyright(c) 2009-2013 TJ Holowaychuk4 * Copyright(c) 2013 Roman Shtylman5 * Copyright(c) 2014-2015 Douglas Christopher Wilson6 * MIT Licensed7 */89'use strict';10

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 11–12why, one step back
11/**
12 * Module dependencies.

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 13why, one step back
13 * @private

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 14–16why, one step back
14 */
1516var accepts = require('accepts');

Merge tag '3.17.1'Douglas Christopher Wilsonbefore adoption3dca534

line 17why, one step back
17var isIP = require('net').isIP;

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 18–26why, one step back
18var typeis = require('type-is');
19var http = require('http');20var fresh = require('fresh');21var parseRange = require('range-parser');22var parse = require('parseurl');23var proxyaddr = require('proxy-addr');2425/**26 * Request prototype.

Merge tag '4.15.0'Douglas Christopher Wilsonbefore adoption501e24e

line 27why, one step back
27 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 28–29why, one step back
28 */
29

Merge tag '4.15.0'Douglas Christopher Wilsonbefore adoption501e24e

line 30why, one step back
30var req = Object.create(http.IncomingMessage.prototype)

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 31–32why, one step back
31
32/**

Merge tag '4.15.0'Douglas Christopher Wilsonbefore adoption501e24e

lines 33–39why, one step back
33 * Module exports.
34 * @public35 */3637module.exports = req3839/**

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 40–59why, one step back
40 * Return request header.
41 *42 * The `Referrer` header field is special-cased,43 * both `Referrer` and `Referer` are interchangeable.44 *45 * Examples:46 *47 * req.get('Content-Type');48 * // => "text/plain"49 *50 * req.get('content-type');51 * // => "text/plain"52 *53 * req.get('Something');54 * // => undefined55 *56 * Aliased as `req.header()`.57 *58 * @param {String} name59 * @return {String}

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 60why, one step back
60 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 61–63why, one step back
61 */
6263req.get =

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 64why, one step back
64req.header = function header(name) {

Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6

lines 65–72why, one step back
65 if (!name) {
66 throw new TypeError('name argument is required to req.get');67 }6869 if (typeof name !== 'string') {70 throw new TypeError('name must be a string to req.get');71 }72

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

lines 73–75why, one step back
73 var lc = name.toLowerCase();
7475 switch (lc) {

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 76–80why, one step back
76 case 'referer':
77 case 'referrer':78 return this.headers.referrer79 || this.headers.referer;80 default:

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 81why, one step back
81 return this.headers[lc];

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 82–91why, one step back
82 }
83};8485/**86 * To do: update docs.87 *88 * Check if the given `type(s)` is acceptable, returning89 * the best match when true, otherwise `undefined`, in which90 * case you should respond with 406 "Not Acceptable".91 *

Merge tag '4.12.0'Douglas Christopher Wilsonbefore adoptionf6ec710

lines 92–94why, one step back
92 * The `type` value may be a single MIME type string
93 * such as "application/json", an extension name94 * such as "json", a comma-delimited list such as "json, html, text/plain",

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 95–96why, one step back
95 * an argument list such as `"json", "html", "text/plain"`,
96 * or an array `["json", "html", "text/plain"]`. When a list

Merge tag '4.12.0'Douglas Christopher Wilsonbefore adoptionf6ec710

line 97why, one step back
97 * or array is given, the _best_ match, if any is returned.

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 98–126why, one step back
98 *
99 * Examples:100 *101 * // Accept: text/html102 * req.accepts('html');103 * // => "html"104 *105 * // Accept: text/*, application/json106 * req.accepts('html');107 * // => "html"108 * req.accepts('text/html');109 * // => "text/html"110 * req.accepts('json, text');111 * // => "json"112 * req.accepts('application/json');113 * // => "application/json"114 *115 * // Accept: text/*, application/json116 * req.accepts('image/png');117 * req.accepts('png');118 * // => undefined119 *120 * // Accept: text/*;q=.5, application/json121 * req.accepts(['html', 'json']);122 * req.accepts('html', 'json');123 * req.accepts('html, json');124 * // => "json"125 *126 * @param {String|Array} type(s)

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

lines 127–128why, one step back
127 * @return {String|Array|Boolean}
128 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 129–139why, one step back
129 */
130131req.accepts = function(){132 var accept = accepts(this);133 return accept.types.apply(accept, arguments);134};135136/**137 * Check if the given `encoding`s are accepted.138 *139 * @param {String} ...encoding

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

lines 140–141why, one step back
140 * @return {String|Array}
141 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 142–153why, one step back
142 */
143144req.acceptsEncodings = function(){145 var accept = accepts(this);146 return accept.encodings.apply(accept, arguments);147};148149/**150 * Check if the given `charset`s are acceptable,151 * otherwise you should respond with 406 "Not Acceptable".152 *153 * @param {String} ...charset

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

lines 154–155why, one step back
154 * @return {String|Array}
155 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 156–167why, one step back
156 */
157158req.acceptsCharsets = function(){159 var accept = accepts(this);160 return accept.charsets.apply(accept, arguments);161};162163/**164 * Check if the given `lang`s are acceptable,165 * otherwise you should respond with 406 "Not Acceptable".166 *167 * @param {String} ...lang

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

lines 168–169why, one step back
168 * @return {String|Array}
169 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 170–177why, one step back
170 */
171172req.acceptsLanguages = function(){173 var accept = accepts(this);174 return accept.languages.apply(accept, arguments);175};176177/**

Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6

line 178why, one step back
178 * Parse Range header field, capping to the given `size`.

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

line 179why, one step back
179 *

Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6

lines 180–183why, one step back
180 * Unspecified ranges such as "0-" require knowledge of your resource length. In
181 * the case of a byte range this is of course the total number of bytes. If the182 * Range header field is not given `undefined` is returned, `-1` when unsatisfiable,183 * and `-2` when syntactically invalid.

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

line 184why, one step back
184 *

Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6

lines 185–187why, one step back
185 * When ranges are returned, the array has a "type" property which is the type of
186 * range that is required (most commonly, "bytes"). Each array element is an object187 * with a "start" and "end" property for the portion of the range.

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

line 188why, one step back
188 *

Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6

lines 189–198why, one step back
189 * The "combine" option can be set to `true` and overlapping & adjacent ranges
190 * will be combined into a single range.191 *192 * NOTE: remember that ranges are inclusive, so for example "Range: users=0-3"193 * should respond with 4 users when available, not 3.194 *195 * @param {number} size196 * @param {object} [options]197 * @param {boolean} [options.combine=false]198 * @return {number|array}

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 199why, one step back
199 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 200–201why, one step back
200 */
201

Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6

line 202why, one step back
202req.range = function range(size, options) {

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 203–204why, one step back
203 var range = this.get('Range');
204 if (!range) return;

Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6

line 205why, one step back
205 return parseRange(size, range, options);

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 206–208why, one step back
206};
207208/**

Change req.query to a getterDouglas Christopher Wilsonbefore adoptiondcc4eaa

lines 209–229why, one step back
209 * Parse the query string of `req.url`.
210 *211 * This uses the "query parser" setting to parse the raw212 * string into an object.213 *214 * @return {String}215 * @api public216 */217218defineGetter(req, 'query', function query(){219 var queryparse = this.app.get('query parser fn');220221 if (!queryparse) {222 // parsing is disabled223 return Object.create(null);224 }225226 var querystring = parse(this).query;227228 return queryparse(querystring);229});

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 230–232why, one step back
230
231/**232 * Check if the incoming request contains the "Content-Type"

Merge tag '4.17.2'Douglas Christopher Wilsonbefore adoptionc7d528c

line 233why, one step back
233 * header field, and it contains the given mime `type`.

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 234–251why, one step back
234 *
235 * Examples:236 *237 * // With Content-Type: text/html; charset=utf-8238 * req.is('html');239 * req.is('text/html');240 * req.is('text/*');241 * // => true242 *243 * // When Content-Type is application/json244 * req.is('json');245 * req.is('application/json');246 * req.is('application/*');247 * // => true248 *249 * req.is('html');250 * // => false251 *

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

lines 252–254why, one step back
252 * @param {String|Array} types...
253 * @return {String|false|null}254 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 255–256why, one step back
255 */
256

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

lines 257–268why, one step back
257req.is = function is(types) {
258 var arr = types;259260 // support flattened arguments261 if (!Array.isArray(types)) {262 arr = new Array(arguments.length);263 for (var i = 0; i < arr.length; i++) {264 arr[i] = arguments[i];265 }266 }267268 return typeis(this, arr);

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 269–281why, one step back
269};
270271/**272 * Return the protocol string "http" or "https"273 * when requested with TLS. When the "trust proxy"274 * setting trusts the socket address, the275 * "X-Forwarded-Proto" header field will be trusted276 * and used if present.277 *278 * If you're running behind a reverse proxy that279 * supplies https for you this may be enabled.280 *281 * @return {String}

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 282why, one step back
282 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 283–290why, one step back
283 */
284285defineGetter(req, 'protocol', function protocol(){286 var proto = this.connection.encrypted287 ? 'https'288 : 'http';289 var trust = this.app.get('trust proxy fn');290

Merge tag '4.12.4'Douglas Christopher Wilsonbefore adoptionf90e045

line 291why, one step back
291 if (!trust(this.connection.remoteAddress, 0)) {

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 292–296why, one step back
292 return proto;
293 }294295 // Note: X-Forwarded-Proto is normally only ever a296 // single value, but this is to be safe.

Merge tag '4.16.2'Douglas Christopher Wilsonbefore adoption62e12fe

lines 297–302why, one step back
297 var header = this.get('X-Forwarded-Proto') || proto
298 var index = header.indexOf(',')299300 return index !== -1301 ? header.substring(0, index).trim()302 : header.trim()

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 303–307why, one step back
303});
304305/**306 * Short-hand for:307 *

Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6

line 308why, one step back
308 * req.protocol === 'https'

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 309–310why, one step back
309 *
310 * @return {Boolean}

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 311why, one step back
311 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 312–314why, one step back
312 */
313314defineGetter(req, 'secure', function secure(){

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 315why, one step back
315 return this.protocol === 'https';

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 316–324why, one step back
316});
317318/**319 * Return the remote address from the trusted proxy.320 *321 * The is the remote address on the socket unless322 * "trust proxy" is set.323 *324 * @return {String}

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 325why, one step back
325 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 326–341why, one step back
326 */
327328defineGetter(req, 'ip', function ip(){329 var trust = this.app.get('trust proxy fn');330 return proxyaddr(this, trust);331});332333/**334 * When "trust proxy" is set, trusted proxy addresses + client.335 *336 * For example if the value were "client, proxy1, proxy2"337 * you would receive the array `["client", "proxy1", "proxy2"]`338 * where "proxy2" is the furthest down-stream and "proxy1" and339 * "proxy2" were trusted.340 *341 * @return {Array}

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 342why, one step back
342 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 343–347why, one step back
343 */
344345defineGetter(req, 'ips', function ips() {346 var trust = this.app.get('trust proxy fn');347 var addrs = proxyaddr.all(this, trust);

Merge tag '4.15.0'Douglas Christopher Wilsonbefore adoption501e24e

lines 348–353why, one step back
348
349 // reverse the order (to farthest -> closest)350 // and remove socket address351 addrs.reverse().pop()352353 return addrs

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 354–367why, one step back
354});
355356/**357 * Return subdomains as an array.358 *359 * Subdomains are the dot-separated parts of the host before the main domain of360 * the app. By default, the domain of the app is assumed to be the last two361 * parts of the host. This can be changed by setting "subdomain offset".362 *363 * For example, if the domain is "tobi.ferrets.example.com":364 * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`.365 * If "subdomain offset" is 3, req.subdomains is `["tobi"]`.366 *367 * @return {Array}

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 368why, one step back
368 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 369–371why, one step back
369 */
370371defineGetter(req, 'subdomains', function subdomains() {

Merge tag '3.17.1'Douglas Christopher Wilsonbefore adoption3dca534

lines 372–375why, one step back
372 var hostname = this.hostname;
373374 if (!hostname) return [];375

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

line 376why, one step back
376 var offset = this.app.get('subdomain offset');

Merge tag '3.17.1'Douglas Christopher Wilsonbefore adoption3dca534

lines 377–381why, one step back
377 var subdomains = !isIP(hostname)
378 ? hostname.split('.').reverse()379 : [hostname];380381 return subdomains.slice(offset);

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 382–387why, one step back
382});
383384/**385 * Short-hand for `url.parse(req.url).pathname`.386 *387 * @return {String}

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 388why, one step back
388 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 389–395why, one step back
389 */
390391defineGetter(req, 'path', function path() {392 return parse(this).pathname;393});394395/**

Change req.host to return hostDouglas Christopher Wilsonbefore adoption085a296

line 396why, one step back
396 * Parse the "Host" header field to a host.

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 397–402why, one step back
397 *
398 * When the "trust proxy" setting trusts the socket399 * address, the "X-Forwarded-Host" header field will400 * be trusted.401 *402 * @return {String}

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 403why, one step back
403 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 404–405why, one step back
404 */
405

Change req.host to return hostDouglas Christopher Wilsonbefore adoption085a296

line 406why, one step back
406defineGetter(req, 'host', function host(){

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

line 407why, one step back
407 var trust = this.app.get('trust proxy fn');

Change req.host to return hostDouglas Christopher Wilsonbefore adoption085a296

line 408why, one step back
408 var val = this.get('X-Forwarded-Host');

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

line 409why, one step back
409

Merge tag '4.12.4'Douglas Christopher Wilsonbefore adoptionf90e045

line 410why, one step back
410 if (!val || !trust(this.connection.remoteAddress, 0)) {

Change req.host to return hostDouglas Christopher Wilsonbefore adoption085a296

line 411why, one step back
411 val = this.get('Host');

Merge tag '4.17.1'Douglas Christopher Wilsonbefore adoption121fe99

lines 412–415why, one step back
412 } else if (val.indexOf(',') !== -1) {
413 // Note: X-Forwarded-Host is normally only ever a414 // single value, but this is to be safe.415 val = val.substring(0, val.indexOf(',')).trimRight()

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 416–417why, one step back
416 }
417

Change req.host to return hostDouglas Christopher Wilsonbefore adoption085a296

lines 418–434why, one step back
418 return val || undefined;
419});420421/**422 * Parse the "Host" header field to a hostname.423 *424 * When the "trust proxy" setting trusts the socket425 * address, the "X-Forwarded-Host" header field will426 * be trusted.427 *428 * @return {String}429 * @api public430 */431432defineGetter(req, 'hostname', function hostname(){433 var host = this.host;434

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 435–442why, one step back
435 if (!host) return;
436437 // IPv6 literal support438 var offset = host[0] === '['439 ? host.indexOf(']') + 1440 : 0;441 var index = host.indexOf(':', offset);442

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 443why, one step back
443 return index !== -1

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 444–453why, one step back
444 ? host.substring(0, index)
445 : host;446});447448/**449 * Check if the request is fresh, aka450 * Last-Modified and/or the ETag451 * still match.452 *453 * @return {Boolean}

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 454why, one step back
454 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 455–458why, one step back
455 */
456457defineGetter(req, 'fresh', function(){458 var method = this.method;

Merge tag '4.15.0'Douglas Christopher Wilsonbefore adoption501e24e

lines 459–460why, one step back
459 var res = this.res
460 var status = res.statusCode

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 461–462why, one step back
461
462 // GET or HEAD for weak freshness validation only

Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6

line 463why, one step back
463 if ('GET' !== method && 'HEAD' !== method) return false;

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 464–465why, one step back
464
465 // 2xx or 304 as per rfc2616 14.26

Merge tag '4.15.0'Douglas Christopher Wilsonbefore adoption501e24e

lines 466–470why, one step back
466 if ((status >= 200 && status < 300) || 304 === status) {
467 return fresh(this.headers, {468 'etag': res.get('ETag'),469 'last-modified': res.get('Last-Modified')470 })

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 471–481why, one step back
471 }
472473 return false;474});475476/**477 * Check if the request is stale, aka478 * "Last-Modified" and / or the "ETag" for the479 * resource has changed.480 *481 * @return {Boolean}

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 482why, one step back
482 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 483–492why, one step back
483 */
484485defineGetter(req, 'stale', function stale(){486 return !this.fresh;487});488489/**490 * Check if the request was an _XMLHttpRequest_.491 *492 * @return {Boolean}

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 493why, one step back
493 * @public

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 494–497why, one step back
494 */
495496defineGetter(req, 'xhr', function xhr(){497 var val = this.get('X-Requested-With') || '';

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 498why, one step back
498 return val.toLowerCase() === 'xmlhttprequest';

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 499–506why, one step back
499});
500501/**502 * Helper function for creating a getter on an object.503 *504 * @param {Object} obj505 * @param {String} name506 * @param {Function} getter

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 507why, one step back
507 * @private

Add res.sendFileDouglas Christopher Wilsonbefore adoption2cb029f

lines 508–514why, one step back
508 */
509function defineGetter(obj, name, getter) {510 Object.defineProperty(obj, name, {511 configurable: true,512 enumerable: true,513 get: getter514 });

Merge tag '4.15.0'Douglas Christopher Wilsonbefore adoption501e24e

line 515why, one step back
515}