routup 0.0.1 → 0.1.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/README.md +11 -9
- package/dist/helpers/request/env.d.ts.map +1 -1
- package/dist/helpers/request/header-accept-charset.d.ts +2 -4
- package/dist/helpers/request/header-accept-charset.d.ts.map +1 -1
- package/dist/helpers/request/header-accept-charset.js +10 -5
- package/dist/helpers/request/header-accept-charset.js.map +1 -1
- package/dist/helpers/request/header-accept-encoding.d.ts +3 -6
- package/dist/helpers/request/header-accept-encoding.d.ts.map +1 -1
- package/dist/helpers/request/header-accept-encoding.js +10 -5
- package/dist/helpers/request/header-accept-encoding.js.map +1 -1
- package/dist/helpers/request/header-accept-language.d.ts +3 -6
- package/dist/helpers/request/header-accept-language.d.ts.map +1 -1
- package/dist/helpers/request/header-accept-language.js +10 -5
- package/dist/helpers/request/header-accept-language.js.map +1 -1
- package/dist/helpers/request/header-accept.d.ts +2 -4
- package/dist/helpers/request/header-accept.d.ts.map +1 -1
- package/dist/helpers/request/header-accept.js +10 -5
- package/dist/helpers/request/header-accept.js.map +1 -1
- package/dist/helpers/request/header-content-type.d.ts +2 -3
- package/dist/helpers/request/header-content-type.d.ts.map +1 -1
- package/dist/helpers/request/header-content-type.js.map +1 -1
- package/dist/helpers/response/header-content-type.d.ts +2 -3
- package/dist/helpers/response/header-content-type.d.ts.map +1 -1
- package/dist/helpers/response/header-content-type.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
# routup
|
|
1
|
+
# routup 🧙
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/routup)
|
|
4
4
|
[](https://github.com/Tada5hi/routup/actions/workflows/main.yml)
|
|
5
|
-
[](https://codecov.io/gh/tada5hi/routup)
|
|
6
6
|
[](https://snyk.io/test/github/Tada5hi/routup)
|
|
7
|
-
[](https://conventionalcommits.org)
|
|
8
|
+
|
|
9
|
+
**Routup** is a lightweight and extendable http interface based routing framework.
|
|
10
|
+
It uses node's vanilla request and response interfaces, which are injected into route handlers aka middlewares as function argument.
|
|
8
11
|
|
|
9
|
-
Routup is a minimalistic & extendable http interface based routing framework.
|
|
10
|
-
It uses node's vanilla request and response interfaces, which are injected into route- & middleware-handlers as function argument.
|
|
11
12
|
Helpers provide additional functionalities to transform and interact with the request and manipulate the response upstream.
|
|
12
13
|
|
|
13
14
|
**Table of Contents**
|
|
@@ -61,10 +62,11 @@ router.listen(3000);
|
|
|
61
62
|
According to the fact that routup is a minimalistic framework, it depends on plugins to cover some
|
|
62
63
|
typically http framework functions, which are not integrated in the main package.
|
|
63
64
|
|
|
64
|
-
| Name | Description
|
|
65
|
-
|
|
66
|
-
| [
|
|
67
|
-
| [
|
|
65
|
+
| Name | Description |
|
|
66
|
+
|-----------------------------------------------------------------------------|------------------------------------------------------------------------|
|
|
67
|
+
| [body](https://www.npmjs.com/package/@routup/tree/master/packages/body) | Read and parse the request body. |
|
|
68
|
+
| [cookie](https://www.npmjs.com/package/@routup/tree/master/packages/cookie) | Read and parse request cookies and serialize cookies for the response. |
|
|
69
|
+
| [query](https://www.npmjs.com/package/@routup/tree/master/packages/query) | Read and parse the query string of the request url. |
|
|
68
70
|
|
|
69
71
|
|
|
70
72
|
## License
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/env.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/env.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAI,IAAI,CAQ9E;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAI,OAAO,GAAG,SAAS,CAM7E"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { IncomingMessage } from 'http';
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function useRequestAcceptsCharsets(req: IncomingMessage, input: string[]): string | undefined;
|
|
6
|
-
export declare function useRequestAcceptsCharsets(req: IncomingMessage, ...input: string[]): string | undefined;
|
|
3
|
+
export declare function getRequestAcceptableCharsets(req: IncomingMessage): string[];
|
|
4
|
+
export declare function getRequestAcceptableCharset(req: IncomingMessage, input: string | string[]): string | undefined;
|
|
7
5
|
//# sourceMappingURL=header-accept-charset.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-accept-charset.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-charset.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAGvC,wBAAgB,
|
|
1
|
+
{"version":3,"file":"header-accept-charset.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-charset.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAGvC,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,eAAe,GAAI,MAAM,EAAE,CAI5E;AAED,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAI,MAAM,GAAG,SAAS,CAW/G"}
|
|
@@ -6,16 +6,21 @@
|
|
|
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.
|
|
9
|
+
exports.getRequestAcceptableCharset = exports.getRequestAcceptableCharsets = void 0;
|
|
10
10
|
const negotiator_1 = require("./negotiator");
|
|
11
|
-
function
|
|
11
|
+
function getRequestAcceptableCharsets(req) {
|
|
12
|
+
const negotiator = (0, negotiator_1.useRequestNegotiator)(req);
|
|
13
|
+
return negotiator.charsets();
|
|
14
|
+
}
|
|
15
|
+
exports.getRequestAcceptableCharsets = getRequestAcceptableCharsets;
|
|
16
|
+
function getRequestAcceptableCharset(req, input) {
|
|
12
17
|
input = input || [];
|
|
13
18
|
const items = Array.isArray(input) ? input : [input];
|
|
14
|
-
const negotiator = (0, negotiator_1.useRequestNegotiator)(req);
|
|
15
19
|
if (items.length === 0) {
|
|
16
|
-
return
|
|
20
|
+
return getRequestAcceptableCharsets(req).shift();
|
|
17
21
|
}
|
|
22
|
+
const negotiator = (0, negotiator_1.useRequestNegotiator)(req);
|
|
18
23
|
return negotiator.charsets(items).shift() || undefined;
|
|
19
24
|
}
|
|
20
|
-
exports.
|
|
25
|
+
exports.getRequestAcceptableCharset = getRequestAcceptableCharset;
|
|
21
26
|
//# sourceMappingURL=header-accept-charset.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-accept-charset.js","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-charset.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,6CAAoD;
|
|
1
|
+
{"version":3,"file":"header-accept-charset.js","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-charset.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,6CAAoD;AAEpD,SAAgB,4BAA4B,CAAC,GAAoB;IAC7D,MAAM,UAAU,GAAG,IAAA,iCAAoB,EAAC,GAAG,CAAC,CAAC;IAE7C,OAAO,UAAU,CAAC,QAAQ,EAAE,CAAC;AACjC,CAAC;AAJD,oEAIC;AAED,SAAgB,2BAA2B,CAAC,GAAoB,EAAE,KAAwB;IACtF,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,4BAA4B,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;KACpD;IAED,MAAM,UAAU,GAAG,IAAA,iCAAoB,EAAC,GAAG,CAAC,CAAC;IAC7C,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,IAAI,SAAS,CAAC;AAC3D,CAAC;AAXD,kEAWC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function useRequestAcceptsEncodings(req: IncomingMessage, input: string): string | undefined;
|
|
5
|
-
export declare function useRequestAcceptsEncodings(req: IncomingMessage, input: string[]): string | undefined;
|
|
6
|
-
export declare function useRequestAcceptsEncodings(req: IncomingMessage, ...input: string[]): string | undefined;
|
|
1
|
+
import { Request } from '../../type';
|
|
2
|
+
export declare function getRequestAcceptableEncodings(req: Request): string[];
|
|
3
|
+
export declare function getRequestAcceptableEncoding(req: Request, input: string | string[]): string | undefined;
|
|
7
4
|
//# sourceMappingURL=header-accept-encoding.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-accept-encoding.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-encoding.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"header-accept-encoding.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-encoding.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,OAAO,GAAI,MAAM,EAAE,CAGrE;AAED,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAI,MAAM,GAAG,SAAS,CAWxG"}
|
|
@@ -6,16 +6,21 @@
|
|
|
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.
|
|
9
|
+
exports.getRequestAcceptableEncoding = exports.getRequestAcceptableEncodings = void 0;
|
|
10
10
|
const negotiator_1 = require("./negotiator");
|
|
11
|
-
function
|
|
11
|
+
function getRequestAcceptableEncodings(req) {
|
|
12
|
+
const negotiator = (0, negotiator_1.useRequestNegotiator)(req);
|
|
13
|
+
return negotiator.encodings();
|
|
14
|
+
}
|
|
15
|
+
exports.getRequestAcceptableEncodings = getRequestAcceptableEncodings;
|
|
16
|
+
function getRequestAcceptableEncoding(req, input) {
|
|
12
17
|
input = input || [];
|
|
13
18
|
const items = Array.isArray(input) ? input : [input];
|
|
14
|
-
const negotiator = (0, negotiator_1.useRequestNegotiator)(req);
|
|
15
19
|
if (items.length === 0) {
|
|
16
|
-
return
|
|
20
|
+
return getRequestAcceptableEncodings(req).shift();
|
|
17
21
|
}
|
|
22
|
+
const negotiator = (0, negotiator_1.useRequestNegotiator)(req);
|
|
18
23
|
return negotiator.encodings(items).shift() || undefined;
|
|
19
24
|
}
|
|
20
|
-
exports.
|
|
25
|
+
exports.getRequestAcceptableEncoding = getRequestAcceptableEncoding;
|
|
21
26
|
//# sourceMappingURL=header-accept-encoding.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-accept-encoding.js","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-encoding.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,6CAAoD;
|
|
1
|
+
{"version":3,"file":"header-accept-encoding.js","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-encoding.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,6CAAoD;AAEpD,SAAgB,6BAA6B,CAAC,GAAY;IACtD,MAAM,UAAU,GAAG,IAAA,iCAAoB,EAAC,GAAG,CAAC,CAAC;IAC7C,OAAO,UAAU,CAAC,SAAS,EAAE,CAAC;AAClC,CAAC;AAHD,sEAGC;AAED,SAAgB,4BAA4B,CAAC,GAAY,EAAE,KAAwB;IAC/E,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,6BAA6B,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;KACrD;IAED,MAAM,UAAU,GAAG,IAAA,iCAAoB,EAAC,GAAG,CAAC,CAAC;IAC7C,OAAO,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,IAAI,SAAS,CAAC;AAC5D,CAAC;AAXD,oEAWC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function useRequestAcceptsLanguages(req: IncomingMessage, input: string): string | undefined;
|
|
5
|
-
export declare function useRequestAcceptsLanguages(req: IncomingMessage, input: string[]): string | undefined;
|
|
6
|
-
export declare function useRequestAcceptsLanguages(req: IncomingMessage, ...input: string[]): string | undefined;
|
|
1
|
+
import { Request } from '../../type';
|
|
2
|
+
export declare function getRequestAcceptableLanguages(req: Request): string[];
|
|
3
|
+
export declare function getRequestAcceptableLanguage(req: Request, input?: string | string[]): string | undefined;
|
|
7
4
|
//# sourceMappingURL=header-accept-language.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-accept-language.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-language.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"header-accept-language.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-language.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,OAAO,GAAI,MAAM,EAAE,CAGrE;AAED,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAI,MAAM,GAAG,SAAS,CAWzG"}
|
|
@@ -6,16 +6,21 @@
|
|
|
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.
|
|
9
|
+
exports.getRequestAcceptableLanguage = exports.getRequestAcceptableLanguages = void 0;
|
|
10
10
|
const negotiator_1 = require("./negotiator");
|
|
11
|
-
function
|
|
11
|
+
function getRequestAcceptableLanguages(req) {
|
|
12
|
+
const negotiator = (0, negotiator_1.useRequestNegotiator)(req);
|
|
13
|
+
return negotiator.languages();
|
|
14
|
+
}
|
|
15
|
+
exports.getRequestAcceptableLanguages = getRequestAcceptableLanguages;
|
|
16
|
+
function getRequestAcceptableLanguage(req, input) {
|
|
12
17
|
input = input || [];
|
|
13
18
|
const items = Array.isArray(input) ? input : [input];
|
|
14
|
-
const negotiator = (0, negotiator_1.useRequestNegotiator)(req);
|
|
15
19
|
if (items.length === 0) {
|
|
16
|
-
return
|
|
20
|
+
return getRequestAcceptableLanguages(req).shift();
|
|
17
21
|
}
|
|
22
|
+
const negotiator = (0, negotiator_1.useRequestNegotiator)(req);
|
|
18
23
|
return negotiator.languages(items).shift() || undefined;
|
|
19
24
|
}
|
|
20
|
-
exports.
|
|
25
|
+
exports.getRequestAcceptableLanguage = getRequestAcceptableLanguage;
|
|
21
26
|
//# sourceMappingURL=header-accept-language.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-accept-language.js","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-language.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,6CAAoD;
|
|
1
|
+
{"version":3,"file":"header-accept-language.js","sourceRoot":"","sources":["../../../src/helpers/request/header-accept-language.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,6CAAoD;AAEpD,SAAgB,6BAA6B,CAAC,GAAY;IACtD,MAAM,UAAU,GAAG,IAAA,iCAAoB,EAAC,GAAG,CAAC,CAAC;IAC7C,OAAO,UAAU,CAAC,SAAS,EAAE,CAAC;AAClC,CAAC;AAHD,sEAGC;AAED,SAAgB,4BAA4B,CAAC,GAAY,EAAE,KAAyB;IAChF,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,6BAA6B,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;KACrD;IAED,MAAM,UAAU,GAAG,IAAA,iCAAoB,EAAC,GAAG,CAAC,CAAC;IAC7C,OAAO,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,IAAI,SAAS,CAAC;AAC5D,CAAC;AAXD,oEAWC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { IncomingMessage } from 'http';
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function useRequestAccepts(req: IncomingMessage, input: string[]): string | undefined;
|
|
6
|
-
export declare function useRequestAccepts(req: IncomingMessage, ...input: string[]): string | undefined;
|
|
3
|
+
export declare function getRequestAcceptableContentTypes(req: IncomingMessage): string[];
|
|
4
|
+
export declare function getRequestAcceptableContentType(req: IncomingMessage, input?: string | string[]): string | undefined;
|
|
7
5
|
//# 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":";AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAKvC,wBAAgB,
|
|
1
|
+
{"version":3,"file":"header-accept.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/header-accept.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAKvC,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,eAAe,GAAI,MAAM,EAAE,CAIhF;AAED,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,eAAe,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAI,MAAM,GAAG,SAAS,CAoCpH"}
|
|
@@ -6,16 +6,20 @@
|
|
|
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.
|
|
9
|
+
exports.getRequestAcceptableContentType = exports.getRequestAcceptableContentTypes = void 0;
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const header_1 = require("./header");
|
|
12
12
|
const negotiator_1 = require("./negotiator");
|
|
13
|
-
function
|
|
13
|
+
function getRequestAcceptableContentTypes(req) {
|
|
14
|
+
const negotiator = (0, negotiator_1.useRequestNegotiator)(req);
|
|
15
|
+
return negotiator.mediaTypes();
|
|
16
|
+
}
|
|
17
|
+
exports.getRequestAcceptableContentTypes = getRequestAcceptableContentTypes;
|
|
18
|
+
function getRequestAcceptableContentType(req, input) {
|
|
14
19
|
input = input || [];
|
|
15
20
|
const items = Array.isArray(input) ? input : [input];
|
|
16
|
-
const negotiator = (0, negotiator_1.useRequestNegotiator)(req);
|
|
17
21
|
if (items.length === 0) {
|
|
18
|
-
return
|
|
22
|
+
return getRequestAcceptableContentTypes(req).shift();
|
|
19
23
|
}
|
|
20
24
|
const header = (0, header_1.getRequestHeader)(req, 'accept');
|
|
21
25
|
if (!header) {
|
|
@@ -32,6 +36,7 @@ function useRequestAccepts(req, input) {
|
|
|
32
36
|
polluted = true;
|
|
33
37
|
}
|
|
34
38
|
}
|
|
39
|
+
const negotiator = (0, negotiator_1.useRequestNegotiator)(req);
|
|
35
40
|
const matches = negotiator.mediaTypes(mimeTypes);
|
|
36
41
|
if (matches.length > 0) {
|
|
37
42
|
if (polluted) {
|
|
@@ -41,5 +46,5 @@ function useRequestAccepts(req, input) {
|
|
|
41
46
|
}
|
|
42
47
|
return undefined;
|
|
43
48
|
}
|
|
44
|
-
exports.
|
|
49
|
+
exports.getRequestAcceptableContentType = getRequestAcceptableContentType;
|
|
45
50
|
//# sourceMappingURL=header-accept.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-accept.js","sourceRoot":"","sources":["../../../src/helpers/request/header-accept.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,uCAA0C;AAC1C,qCAA4C;AAC5C,6CAAoD;
|
|
1
|
+
{"version":3,"file":"header-accept.js","sourceRoot":"","sources":["../../../src/helpers/request/header-accept.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,uCAA0C;AAC1C,qCAA4C;AAC5C,6CAAoD;AAEpD,SAAgB,gCAAgC,CAAC,GAAoB;IACjE,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,GAAoB,EAAE,KAAyB;IAC3F,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,QAAQ,CAAC,CAAC;IAC/C,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,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare function matchRequestContentType(req: IncomingMessage, contentType: string): boolean;
|
|
1
|
+
import { Request } from '../../type';
|
|
2
|
+
export declare function matchRequestContentType(req: Request, contentType: string): boolean;
|
|
4
3
|
//# sourceMappingURL=header-content-type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-content-type.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/header-content-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"header-content-type.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/header-content-type.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAI,OAAO,CAgBnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-content-type.js","sourceRoot":"","sources":["../../../src/helpers/request/header-content-type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;
|
|
1
|
+
{"version":3,"file":"header-content-type.js","sourceRoot":"","sources":["../../../src/helpers/request/header-content-type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+CAA6C;AAE7C,uCAA0C;AAC1C,qCAA4C;AAE5C,SAAgB,uBAAuB,CAAC,GAAY,EAAE,WAAmB;IACrE,MAAM,MAAM,GAAG,IAAA,yBAAgB,EAAC,GAAG,EAAE,sBAAU,CAAC,YAAY,CAAC,CAAC;IAC9D,IAAI,CAAC,MAAM,EAAE;QACT,OAAO,IAAI,CAAC;KACf;IAED,0BAA0B;IAC1B,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACvB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACrB,OAAO,IAAI,CAAC;SACf;QAED,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,IAAA,mBAAW,EAAC,WAAW,CAAC,CAAC;KACjD;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,IAAA,mBAAW,EAAC,WAAW,CAAC,CAAC;AACnE,CAAC;AAhBD,0DAgBC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare function setResponseHeaderContentType(res: ServerResponse, input: string, ifNotExists?: boolean): void;
|
|
1
|
+
import { Response } from '../../type';
|
|
2
|
+
export declare function setResponseHeaderContentType(res: Response, input: string, ifNotExists?: boolean): void;
|
|
4
3
|
//# sourceMappingURL=header-content-type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-content-type.d.ts","sourceRoot":"","sources":["../../../src/helpers/response/header-content-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"header-content-type.d.ts","sourceRoot":"","sources":["../../../src/helpers/response/header-content-type.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,QAY/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-content-type.js","sourceRoot":"","sources":["../../../src/helpers/response/header-content-type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;
|
|
1
|
+
{"version":3,"file":"header-content-type.js","sourceRoot":"","sources":["../../../src/helpers/response/header-content-type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+CAA6C;AAE7C,uCAA0C;AAE1C,SAAgB,4BAA4B,CAAC,GAAa,EAAE,KAAa,EAAE,WAAqB;IAC5F,IAAI,WAAW,EAAE;QACb,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,sBAAU,CAAC,YAAY,CAAC,CAAC;QACtD,IAAI,MAAM,EAAE;YACR,OAAO;SACV;KACJ;IAED,MAAM,WAAW,GAAG,IAAA,mBAAW,EAAC,KAAK,CAAC,CAAC;IACvC,IAAI,WAAW,EAAE;QACb,GAAG,CAAC,SAAS,CAAC,sBAAU,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;KACvD;AACL,CAAC;AAZD,oEAYC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "routup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.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,6 @@
|
|
|
52
52
|
"negotiator": "^0.6.3",
|
|
53
53
|
"path-to-regexp": "^6.2.1",
|
|
54
54
|
"smob": "^0.0.6"
|
|
55
|
-
}
|
|
55
|
+
},
|
|
56
|
+
"gitHead": "b0c55a29be09b483fad27962505c040602c92a0e"
|
|
56
57
|
}
|