@pristine-ts/common 0.0.185 → 0.0.189
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,7 +6,7 @@ class Request {
|
|
|
6
6
|
/**
|
|
7
7
|
* The headers of the request.
|
|
8
8
|
*/
|
|
9
|
-
this.
|
|
9
|
+
this._headers = {};
|
|
10
10
|
/**
|
|
11
11
|
* The body of the request.
|
|
12
12
|
*/
|
|
@@ -14,6 +14,25 @@ class Request {
|
|
|
14
14
|
this.httpMethod = httpMethod;
|
|
15
15
|
this.url = url;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* This method returns all the headers.
|
|
19
|
+
*/
|
|
20
|
+
get headers() {
|
|
21
|
+
return this._headers;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* This method sets the headers appropriately.
|
|
25
|
+
*
|
|
26
|
+
* @param headers
|
|
27
|
+
*/
|
|
28
|
+
setHeaders(headers) {
|
|
29
|
+
for (const name in headers) {
|
|
30
|
+
if (headers.hasOwnProperty(name) === false) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
this.setHeader(name, headers[name]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
17
36
|
/**
|
|
18
37
|
* This method sets a header parameter in the Request.
|
|
19
38
|
*
|
|
@@ -21,7 +40,7 @@ class Request {
|
|
|
21
40
|
* @param value The value of the header.
|
|
22
41
|
*/
|
|
23
42
|
setHeader(name, value) {
|
|
24
|
-
this.headers[name] = value;
|
|
43
|
+
this.headers[name.toLowerCase()] = value;
|
|
25
44
|
}
|
|
26
45
|
/**
|
|
27
46
|
* This method returns whether or not the header exists in the Request.
|
|
@@ -29,7 +48,7 @@ class Request {
|
|
|
29
48
|
* @param name The name of the header.
|
|
30
49
|
*/
|
|
31
50
|
hasHeader(name) {
|
|
32
|
-
return this.headers.hasOwnProperty(name);
|
|
51
|
+
return this.headers.hasOwnProperty(name.toLowerCase());
|
|
33
52
|
}
|
|
34
53
|
/**
|
|
35
54
|
* This method returns the header corresponding to the name or undefined if it doesn't exist.
|
|
@@ -37,7 +56,7 @@ class Request {
|
|
|
37
56
|
* @param name The name of the header.
|
|
38
57
|
*/
|
|
39
58
|
getHeader(name) {
|
|
40
|
-
return this.headers[name];
|
|
59
|
+
return this.headers[name.toLowerCase()];
|
|
41
60
|
}
|
|
42
61
|
}
|
|
43
62
|
exports.Request = Request;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/models/request.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/models/request.ts"],"names":[],"mappings":";;;AAMA,MAAa,OAAO;IA0BhB,YAAY,UAA+B,EAAE,GAAW;QAfxD;;WAEG;QACK,aAAQ,GAA8B,EAAE,CAAC;QAEjD;;WAEG;QACH,SAAI,GAAQ,EAAE,CAAC;QAQX,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACI,UAAU,CAAC,OAAkC;QAChD,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE;YACxB,IAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE;gBACvC,SAAS;aACZ;YAED,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;SACtC;IACL,CAAC;IAED;;;;;OAKG;IACI,SAAS,CAAC,IAAY,EAAE,KAAa;QACxC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAC5C,CAAC;CACJ;AAhFD,0BAgFC"}
|
|
@@ -3,7 +3,7 @@ export class Request {
|
|
|
3
3
|
/**
|
|
4
4
|
* The headers of the request.
|
|
5
5
|
*/
|
|
6
|
-
this.
|
|
6
|
+
this._headers = {};
|
|
7
7
|
/**
|
|
8
8
|
* The body of the request.
|
|
9
9
|
*/
|
|
@@ -11,6 +11,25 @@ export class Request {
|
|
|
11
11
|
this.httpMethod = httpMethod;
|
|
12
12
|
this.url = url;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* This method returns all the headers.
|
|
16
|
+
*/
|
|
17
|
+
get headers() {
|
|
18
|
+
return this._headers;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* This method sets the headers appropriately.
|
|
22
|
+
*
|
|
23
|
+
* @param headers
|
|
24
|
+
*/
|
|
25
|
+
setHeaders(headers) {
|
|
26
|
+
for (const name in headers) {
|
|
27
|
+
if (headers.hasOwnProperty(name) === false) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
this.setHeader(name, headers[name]);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
14
33
|
/**
|
|
15
34
|
* This method sets a header parameter in the Request.
|
|
16
35
|
*
|
|
@@ -18,7 +37,7 @@ export class Request {
|
|
|
18
37
|
* @param value The value of the header.
|
|
19
38
|
*/
|
|
20
39
|
setHeader(name, value) {
|
|
21
|
-
this.headers[name] = value;
|
|
40
|
+
this.headers[name.toLowerCase()] = value;
|
|
22
41
|
}
|
|
23
42
|
/**
|
|
24
43
|
* This method returns whether or not the header exists in the Request.
|
|
@@ -26,7 +45,7 @@ export class Request {
|
|
|
26
45
|
* @param name The name of the header.
|
|
27
46
|
*/
|
|
28
47
|
hasHeader(name) {
|
|
29
|
-
return this.headers.hasOwnProperty(name);
|
|
48
|
+
return this.headers.hasOwnProperty(name.toLowerCase());
|
|
30
49
|
}
|
|
31
50
|
/**
|
|
32
51
|
* This method returns the header corresponding to the name or undefined if it doesn't exist.
|
|
@@ -34,7 +53,7 @@ export class Request {
|
|
|
34
53
|
* @param name The name of the header.
|
|
35
54
|
*/
|
|
36
55
|
getHeader(name) {
|
|
37
|
-
return this.headers[name];
|
|
56
|
+
return this.headers[name.toLowerCase()];
|
|
38
57
|
}
|
|
39
58
|
}
|
|
40
59
|
//# sourceMappingURL=request.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/models/request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/models/request.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,OAAO;IA0BhB,YAAY,UAA+B,EAAE,GAAW;QAfxD;;WAEG;QACK,aAAQ,GAA8B,EAAE,CAAC;QAEjD;;WAEG;QACH,SAAI,GAAQ,EAAE,CAAC;QAQX,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACI,UAAU,CAAC,OAAkC;QAChD,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE;YACxB,IAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE;gBACvC,SAAS;aACZ;YAED,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;SACtC;IACL,CAAC;IAED;;;;;OAKG;IACI,SAAS,CAAC,IAAY,EAAE,KAAa;QACxC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAC5C,CAAC;CACJ"}
|
|
@@ -14,9 +14,7 @@ export declare class Request {
|
|
|
14
14
|
/**
|
|
15
15
|
* The headers of the request.
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
[key: string]: string;
|
|
19
|
-
};
|
|
17
|
+
private _headers;
|
|
20
18
|
/**
|
|
21
19
|
* The body of the request.
|
|
22
20
|
*/
|
|
@@ -26,6 +24,20 @@ export declare class Request {
|
|
|
26
24
|
*/
|
|
27
25
|
rawBody?: any;
|
|
28
26
|
constructor(httpMethod: HttpMethod | string, url: string);
|
|
27
|
+
/**
|
|
28
|
+
* This method returns all the headers.
|
|
29
|
+
*/
|
|
30
|
+
get headers(): {
|
|
31
|
+
[key: string]: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* This method sets the headers appropriately.
|
|
35
|
+
*
|
|
36
|
+
* @param headers
|
|
37
|
+
*/
|
|
38
|
+
setHeaders(headers: {
|
|
39
|
+
[key: string]: string;
|
|
40
|
+
}): void;
|
|
29
41
|
/**
|
|
30
42
|
* This method sets a header parameter in the Request.
|
|
31
43
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pristine-ts/common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.189",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/lib/esm/common.module.js",
|
|
6
6
|
"main": "dist/lib/cjs/common.module.js",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"src/*.{js,ts}"
|
|
57
57
|
]
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "8e39ed86b4bd7fdb510ccb8aee4955df82010f90"
|
|
60
60
|
}
|