routup 0.4.0 → 0.4.1
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.
- package/dist/constants.d.ts +8 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +7 -4
- package/dist/constants.js.map +1 -1
- package/dist/helpers/request/header-accept.d.ts +3 -4
- package/dist/helpers/request/header-accept.d.ts.map +1 -1
- package/dist/helpers/request/header-accept.js +2 -1
- package/dist/helpers/request/header-accept.js.map +1 -1
- package/dist/helpers/response/header.d.ts +4 -2
- package/dist/helpers/response/header.d.ts.map +1 -1
- package/dist/helpers/response/header.js +13 -1
- package/dist/helpers/response/header.js.map +1 -1
- package/package.json +2 -2
package/dist/constants.d.ts
CHANGED
|
@@ -6,15 +6,18 @@ export declare enum Method {
|
|
|
6
6
|
DELETE = "delete"
|
|
7
7
|
}
|
|
8
8
|
export declare enum HeaderName {
|
|
9
|
-
METHOD = "method",
|
|
10
|
-
URL = "url",
|
|
11
|
-
STATUS_CODE = "staus-code",
|
|
12
|
-
STATUS_MESSAGE = "status-message",
|
|
13
9
|
ACCEPT = "accept",
|
|
10
|
+
ACCEPT_CHARSET = "accept-charset",
|
|
11
|
+
ACCEPT_ENCODING = "accept-encoding",
|
|
12
|
+
ACCEPT_LANGUAGE = "accept-language",
|
|
13
|
+
CACHE_CONTROL = "cache-control",
|
|
14
14
|
CONTENT_DISPOSITION = "content-disposition",
|
|
15
15
|
CONTENT_ENCODING = "content-encoding",
|
|
16
16
|
CONTENT_LENGTH = "content-length",
|
|
17
17
|
CONTENT_TYPE = "content-type",
|
|
18
|
-
COOKIE = "cookie"
|
|
18
|
+
COOKIE = "cookie",
|
|
19
|
+
LAST_MODIFIED = "last-modified",
|
|
20
|
+
LOCATION = "location",
|
|
21
|
+
SET_COOKIE = "set-cookie"
|
|
19
22
|
}
|
|
20
23
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,MAAM;IACd,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,MAAM,WAAW;CACpB;AAED,oBAAY,UAAU;IAClB,MAAM,WAAW;IACjB,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,MAAM;IACd,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,MAAM,WAAW;CACpB;AAED,oBAAY,UAAU;IAClB,MAAM,WAAW;IACjB,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,eAAe,oBAAoB;IACnC,aAAa,kBAAkB;IAC/B,mBAAmB,wBAAwB;IAC3C,gBAAgB,qBAAqB;IACrC,cAAc,mBAAmB;IACjC,YAAY,iBAAiB;IAC7B,MAAM,WAAW;IACjB,aAAa,kBAAkB;IAC/B,QAAQ,aAAa;IACrB,UAAU,eAAe;CAC5B"}
|
package/dist/constants.js
CHANGED
|
@@ -17,15 +17,18 @@ var Method;
|
|
|
17
17
|
})(Method = exports.Method || (exports.Method = {}));
|
|
18
18
|
var HeaderName;
|
|
19
19
|
(function (HeaderName) {
|
|
20
|
-
HeaderName["METHOD"] = "method";
|
|
21
|
-
HeaderName["URL"] = "url";
|
|
22
|
-
HeaderName["STATUS_CODE"] = "staus-code";
|
|
23
|
-
HeaderName["STATUS_MESSAGE"] = "status-message";
|
|
24
20
|
HeaderName["ACCEPT"] = "accept";
|
|
21
|
+
HeaderName["ACCEPT_CHARSET"] = "accept-charset";
|
|
22
|
+
HeaderName["ACCEPT_ENCODING"] = "accept-encoding";
|
|
23
|
+
HeaderName["ACCEPT_LANGUAGE"] = "accept-language";
|
|
24
|
+
HeaderName["CACHE_CONTROL"] = "cache-control";
|
|
25
25
|
HeaderName["CONTENT_DISPOSITION"] = "content-disposition";
|
|
26
26
|
HeaderName["CONTENT_ENCODING"] = "content-encoding";
|
|
27
27
|
HeaderName["CONTENT_LENGTH"] = "content-length";
|
|
28
28
|
HeaderName["CONTENT_TYPE"] = "content-type";
|
|
29
29
|
HeaderName["COOKIE"] = "cookie";
|
|
30
|
+
HeaderName["LAST_MODIFIED"] = "last-modified";
|
|
31
|
+
HeaderName["LOCATION"] = "location";
|
|
32
|
+
HeaderName["SET_COOKIE"] = "set-cookie";
|
|
30
33
|
})(HeaderName = exports.HeaderName || (exports.HeaderName = {}));
|
|
31
34
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,IAAY,MAMX;AAND,WAAY,MAAM;IACd,qBAAW,CAAA;IACX,uBAAa,CAAA;IACb,qBAAW,CAAA;IACX,yBAAe,CAAA;IACf,2BAAiB,CAAA;AACrB,CAAC,EANW,MAAM,GAAN,cAAM,KAAN,cAAM,QAMjB;AAED,IAAY,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,IAAY,MAMX;AAND,WAAY,MAAM;IACd,qBAAW,CAAA;IACX,uBAAa,CAAA;IACb,qBAAW,CAAA;IACX,yBAAe,CAAA;IACf,2BAAiB,CAAA;AACrB,CAAC,EANW,MAAM,GAAN,cAAM,KAAN,cAAM,QAMjB;AAED,IAAY,UAcX;AAdD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,+CAAiC,CAAA;IACjC,iDAAmC,CAAA;IACnC,iDAAmC,CAAA;IACnC,6CAA+B,CAAA;IAC/B,yDAA2C,CAAA;IAC3C,mDAAqC,CAAA;IACrC,+CAAiC,CAAA;IACjC,2CAA6B,CAAA;IAC7B,+BAAiB,CAAA;IACjB,6CAA+B,CAAA;IAC/B,mCAAqB,CAAA;IACrB,uCAAyB,CAAA;AAC7B,CAAC,EAdW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAcrB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function getRequestAcceptableContentType(req: IncomingMessage, input?: string | string[]): string | undefined;
|
|
1
|
+
import { Request } from '../../type';
|
|
2
|
+
export declare function getRequestAcceptableContentTypes(req: Request): string[];
|
|
3
|
+
export declare function getRequestAcceptableContentType(req: Request, input?: string | string[]): string | undefined;
|
|
5
4
|
//# sourceMappingURL=header-accept.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-accept.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/header-accept.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"header-accept.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/header-accept.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAKrC,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,OAAO,GAAI,MAAM,EAAE,CAIxE;AAED,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAI,MAAM,GAAG,SAAS,CAoC5G"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.getRequestAcceptableContentType = exports.getRequestAcceptableContentTypes = void 0;
|
|
10
|
+
const constants_1 = require("../../constants");
|
|
10
11
|
const utils_1 = require("../../utils");
|
|
11
12
|
const header_1 = require("./header");
|
|
12
13
|
const negotiator_1 = require("./negotiator");
|
|
@@ -21,7 +22,7 @@ function getRequestAcceptableContentType(req, input) {
|
|
|
21
22
|
if (items.length === 0) {
|
|
22
23
|
return getRequestAcceptableContentTypes(req).shift();
|
|
23
24
|
}
|
|
24
|
-
const header = (0, header_1.getRequestHeader)(req,
|
|
25
|
+
const header = (0, header_1.getRequestHeader)(req, constants_1.HeaderName.ACCEPT);
|
|
25
26
|
if (!header) {
|
|
26
27
|
return items[0];
|
|
27
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-accept.js","sourceRoot":"","sources":["../../../src/helpers/request/header-accept.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;
|
|
1
|
+
{"version":3,"file":"header-accept.js","sourceRoot":"","sources":["../../../src/helpers/request/header-accept.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+CAA6C;AAE7C,uCAA0C;AAC1C,qCAA4C;AAC5C,6CAAoD;AAEpD,SAAgB,gCAAgC,CAAC,GAAY;IACzD,MAAM,UAAU,GAAG,IAAA,iCAAoB,EAAC,GAAG,CAAC,CAAC;IAE7C,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;AACnC,CAAC;AAJD,4EAIC;AAED,SAAgB,+BAA+B,CAAC,GAAY,EAAE,KAAyB;IACnF,KAAK,GAAG,KAAK,IAAI,EAAE,CAAC;IAEpB,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAErD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACpB,OAAO,gCAAgC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;KACxD;IAED,MAAM,MAAM,GAAG,IAAA,yBAAgB,EAAC,GAAG,EAAE,sBAAU,CAAC,MAAM,CAAC,CAAC;IACxD,IAAI,CAAC,MAAM,EAAE;QACT,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;KACnB;IAED,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,MAAM,SAAS,GAAc,EAAE,CAAC;IAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,MAAM,QAAQ,GAAG,IAAA,mBAAW,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,QAAQ,EAAE;YACV,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC5B;aAAM;YACH,QAAQ,GAAG,IAAI,CAAC;SACnB;KACJ;IAED,MAAM,UAAU,GAAG,IAAA,iCAAoB,EAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACjD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QACpB,IAAI,QAAQ,EAAE;YACV,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;SACnB;QAED,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC/C;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AApCD,0EAoCC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { OutgoingHttpHeader
|
|
3
|
-
|
|
2
|
+
import { OutgoingHttpHeader } from 'http';
|
|
3
|
+
import { Response } from '../../type';
|
|
4
|
+
export declare function appendResponseHeader(res: Response, name: string, value: OutgoingHttpHeader): void;
|
|
5
|
+
export declare function appendResponseHeaderDirective(res: Response, name: string, value: OutgoingHttpHeader): void;
|
|
4
6
|
//# sourceMappingURL=header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/helpers/response/header.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/helpers/response/header.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,wBAAgB,oBAAoB,CAChC,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,kBAAkB,QAc5B;AAED,wBAAgB,6BAA6B,CACzC,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,kBAAkB,QAiC5B"}
|
|
@@ -6,7 +6,19 @@
|
|
|
6
6
|
* view the LICENSE file that was distributed with this source code.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.appendResponseHeaderDirective = void 0;
|
|
9
|
+
exports.appendResponseHeaderDirective = exports.appendResponseHeader = void 0;
|
|
10
|
+
function appendResponseHeader(res, name, value) {
|
|
11
|
+
let header = res.getHeader(name);
|
|
12
|
+
if (!header) {
|
|
13
|
+
res.setHeader(name, value);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!Array.isArray(header)) {
|
|
17
|
+
header = [header.toString()];
|
|
18
|
+
}
|
|
19
|
+
res.setHeader(name, [...header, value]);
|
|
20
|
+
}
|
|
21
|
+
exports.appendResponseHeader = appendResponseHeader;
|
|
10
22
|
function appendResponseHeaderDirective(res, name, value) {
|
|
11
23
|
let header = res.getHeader(name);
|
|
12
24
|
if (!header) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../../src/helpers/response/header.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;
|
|
1
|
+
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../../src/helpers/response/header.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAKH,SAAgB,oBAAoB,CAChC,GAAa,EACb,IAAY,EACZ,KAAyB;IAEzB,IAAI,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,IAA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CAAC;KAC3B;IAED,gCAAgC;IAEhC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3C,CAAC;AApCD,sEAoCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "routup",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Routup is a minimalistic http based routing framework.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"path-to-regexp": "^6.2.1",
|
|
53
53
|
"smob": "^0.0.6"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "0c9841d84a8eff4df16c6c3cb6c6428b24ae134a"
|
|
56
56
|
}
|