MCPcopy
hub / github.com/oauthjs/node-oauth2-server / Request

Function Request

lib/request.js:14–47  ·  view source on GitHub ↗

* Constructor.

(options)

Source from the content-addressed store, hash-verified

12 */
13
14function Request(options) {
15 options = options || {};
16
17 if (!options.headers) {
18 throw new InvalidArgumentError('Missing parameter: `headers`');
19 }
20
21 if (!options.method) {
22 throw new InvalidArgumentError('Missing parameter: `method`');
23 }
24
25 if (!options.query) {
26 throw new InvalidArgumentError('Missing parameter: `query`');
27 }
28
29 this.body = options.body || {};
30 this.headers = {};
31 this.method = options.method;
32 this.query = options.query;
33
34 // Store the headers in lower case.
35 for (var field in options.headers) {
36 if (Object.prototype.hasOwnProperty.call(options.headers, field)) {
37 this.headers[field.toLowerCase()] = options.headers[field];
38 }
39 }
40
41 // Store additional properties of the request object passed in
42 for (var property in options) {
43 if (Object.prototype.hasOwnProperty.call(options, property) && !this[property]) {
44 this[property] = options[property];
45 }
46 }
47}
48
49/**
50 * Get a request header.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected