@zuplo/cli 6.71.27 → 6.72.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/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.github/dependabot.yml +42 -2
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/README.md +5 -5
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/index.js +4 -7
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/package.json +3 -3
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/additionalProperties.test.js +47 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/const.test.js +20 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/patternProperties.test.js +24 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/.gitattributes +2 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/.github/dependabot.yml +53 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/.github/workflows/ci.yml +154 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/LICENSE +30 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/README.md +152 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/benchmark.mjs +159 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/encoder.mjs +54 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/equal.mjs +51 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/non-simple-domain.mjs +22 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/package.json +17 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs +24 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/ws-is-secure.mjs +65 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/eslint.config.js +6 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/index.js +405 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/lib/schemes.js +267 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/lib/utils.js +585 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/package.json +68 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/ajv.test.js +43 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/equal.test.js +168 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/fixtures/uri-js-parse.json +501 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/fixtures/uri-js-serialize.json +120 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/parse.test.js +325 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/query-fragment-normalization.test.js +33 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/resolve.test.js +87 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/rfc-3986.test.js +90 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/scheme-normalization.test.js +16 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/security-normalization.test.js +39 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/security-utf8-encoding.test.js +0 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/security.test.js +161 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/serialize.test.js +151 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/uri-js-compatibility.test.js +33 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/uri-js.test.js +912 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/util.test.js +47 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/tsconfig.json +10 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/types/index.d.ts +51 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/types/index.tst.ts +15 -0
- package/node_modules/@posthog/core/dist/index.d.ts +3 -0
- package/node_modules/@posthog/core/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/index.js +133 -93
- package/node_modules/@posthog/core/dist/index.mjs +2 -1
- package/node_modules/@posthog/core/dist/metrics/index.d.ts +61 -0
- package/node_modules/@posthog/core/dist/metrics/index.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/metrics/index.js +326 -0
- package/node_modules/@posthog/core/dist/metrics/index.mjs +283 -0
- package/node_modules/@posthog/core/dist/metrics/metrics-utils.d.ts +41 -0
- package/node_modules/@posthog/core/dist/metrics/metrics-utils.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/metrics/metrics-utils.js +117 -0
- package/node_modules/@posthog/core/dist/metrics/metrics-utils.mjs +68 -0
- package/node_modules/@posthog/core/dist/metrics/types.d.ts +69 -0
- package/node_modules/@posthog/core/dist/metrics/types.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/metrics/types.js +18 -0
- package/node_modules/@posthog/core/dist/metrics/types.mjs +0 -0
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +2 -0
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.js +16 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +16 -1
- package/node_modules/@posthog/core/package.json +2 -2
- package/node_modules/@posthog/core/src/index.ts +20 -0
- package/node_modules/@posthog/core/src/metrics/index.spec.ts +459 -0
- package/node_modules/@posthog/core/src/metrics/index.ts +414 -0
- package/node_modules/@posthog/core/src/metrics/metrics-utils.ts +100 -0
- package/node_modules/@posthog/core/src/metrics/types.ts +89 -0
- package/node_modules/@posthog/core/src/posthog-core-stateless.ts +26 -0
- package/node_modules/@posthog/types/dist/capture-metric.d.ts +122 -0
- package/node_modules/@posthog/types/dist/capture-metric.d.ts.map +1 -0
- package/node_modules/@posthog/types/dist/capture-metric.js +36 -0
- package/node_modules/@posthog/types/dist/capture-metric.mjs +2 -0
- package/node_modules/@posthog/types/dist/index.d.ts +3 -1
- package/node_modules/@posthog/types/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/index.js +19 -1
- package/node_modules/@posthog/types/dist/index.mjs +2 -0
- package/node_modules/@posthog/types/dist/posthog-config.d.ts +60 -0
- package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/capture-metric.ts +133 -0
- package/node_modules/@posthog/types/src/index.ts +17 -0
- package/node_modules/@posthog/types/src/posthog-config.ts +62 -0
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/fs/promises.d.ts +16 -6
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-D3O7C43P.js → chunk-IC7XGD5C.js} +93 -93
- package/node_modules/@zuplo/runtime/out/esm/chunk-IC7XGD5C.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +9 -9
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +830 -6
- package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +30 -0
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.js +11 -4
- package/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.min.js +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.js +11 -4
- package/node_modules/lru-cache/dist/commonjs/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.min.js +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.js +11 -4
- package/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.min.js +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.js +11 -4
- package/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.min.js +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.js +11 -4
- package/node_modules/lru-cache/dist/esm/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.min.js +1 -1
- package/node_modules/lru-cache/dist/esm/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.js +11 -4
- package/node_modules/lru-cache/dist/esm/node/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.min.js +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.min.js.map +3 -3
- package/node_modules/lru-cache/package.json +1 -1
- package/package.json +6 -6
- package/node_modules/@zuplo/runtime/out/esm/chunk-D3O7C43P.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-D3O7C43P.js.LEGAL.txt → chunk-IC7XGD5C.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
[
|
|
2
|
+
[
|
|
3
|
+
{
|
|
4
|
+
"host": "10.10.10.10.example.com"
|
|
5
|
+
},
|
|
6
|
+
"//10.10.10.10.example.com"
|
|
7
|
+
],
|
|
8
|
+
[
|
|
9
|
+
{
|
|
10
|
+
"host": "2001:db8::7"
|
|
11
|
+
},
|
|
12
|
+
"//[2001:db8::7]"
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
{
|
|
16
|
+
"host": "::ffff:129.144.52.38"
|
|
17
|
+
},
|
|
18
|
+
"//[::ffff:129.144.52.38]"
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
{
|
|
22
|
+
"host": "2606:2800:220:1:248:1893:25c8:1946"
|
|
23
|
+
},
|
|
24
|
+
"//[2606:2800:220:1:248:1893:25c8:1946]"
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
{
|
|
28
|
+
"host": "10.10.10.10.example.com"
|
|
29
|
+
},
|
|
30
|
+
"//10.10.10.10.example.com"
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
{
|
|
34
|
+
"host": "10.10.10.10"
|
|
35
|
+
},
|
|
36
|
+
"//10.10.10.10"
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
{
|
|
40
|
+
"path": "?query"
|
|
41
|
+
},
|
|
42
|
+
"%3Fquery"
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
{
|
|
46
|
+
"path": "foo:bar"
|
|
47
|
+
},
|
|
48
|
+
"foo%3Abar"
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
{
|
|
52
|
+
"path": "//path"
|
|
53
|
+
},
|
|
54
|
+
"/%2Fpath"
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
{
|
|
58
|
+
"scheme": "uri",
|
|
59
|
+
"host": "example.com",
|
|
60
|
+
"port": "9000"
|
|
61
|
+
},
|
|
62
|
+
"uri://example.com:9000"
|
|
63
|
+
],
|
|
64
|
+
[
|
|
65
|
+
{
|
|
66
|
+
"scheme": "uri",
|
|
67
|
+
"userinfo": "foo:bar",
|
|
68
|
+
"host": "example.com",
|
|
69
|
+
"port": 1,
|
|
70
|
+
"path": "path",
|
|
71
|
+
"query": "query",
|
|
72
|
+
"fragment": "fragment"
|
|
73
|
+
},
|
|
74
|
+
"uri://foo:bar@example.com:1/path?query#fragment"
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
{
|
|
78
|
+
"scheme": "",
|
|
79
|
+
"userinfo": "",
|
|
80
|
+
"host": "",
|
|
81
|
+
"port": 0,
|
|
82
|
+
"path": "",
|
|
83
|
+
"query": "",
|
|
84
|
+
"fragment": ""
|
|
85
|
+
},
|
|
86
|
+
"//@:0?#"
|
|
87
|
+
],
|
|
88
|
+
[
|
|
89
|
+
{},
|
|
90
|
+
""
|
|
91
|
+
],
|
|
92
|
+
[
|
|
93
|
+
{
|
|
94
|
+
"host": "fe80::a%en1"
|
|
95
|
+
},
|
|
96
|
+
"//[fe80::a%25en1]"
|
|
97
|
+
],
|
|
98
|
+
[
|
|
99
|
+
{
|
|
100
|
+
"host": "fe80::a%25en1"
|
|
101
|
+
},
|
|
102
|
+
"//[fe80::a%25en1]"
|
|
103
|
+
],
|
|
104
|
+
[
|
|
105
|
+
{
|
|
106
|
+
"scheme": "wss",
|
|
107
|
+
"host": "example.com",
|
|
108
|
+
"path": "/foo",
|
|
109
|
+
"query": "bar"
|
|
110
|
+
},
|
|
111
|
+
"wss://example.com/foo?bar"
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
{
|
|
115
|
+
"scheme": "scheme",
|
|
116
|
+
"path": "with:colon"
|
|
117
|
+
},
|
|
118
|
+
"scheme:with:colon"
|
|
119
|
+
]
|
|
120
|
+
]
|
package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/parse.test.js
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('tape')
|
|
4
|
+
const fastURI = require('..')
|
|
5
|
+
|
|
6
|
+
test('URI parse', (t) => {
|
|
7
|
+
let components
|
|
8
|
+
|
|
9
|
+
// scheme
|
|
10
|
+
components = fastURI.parse('uri:')
|
|
11
|
+
t.equal(components.error, undefined, 'scheme errors')
|
|
12
|
+
t.equal(components.scheme, 'uri', 'scheme')
|
|
13
|
+
// t.equal(components.authority, undefined, "authority");
|
|
14
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
15
|
+
t.equal(components.host, undefined, 'host')
|
|
16
|
+
t.equal(components.port, undefined, 'port')
|
|
17
|
+
t.equal(components.path, '', 'path')
|
|
18
|
+
t.equal(components.query, undefined, 'query')
|
|
19
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
20
|
+
|
|
21
|
+
// userinfo
|
|
22
|
+
components = fastURI.parse('//@')
|
|
23
|
+
t.equal(components.error, undefined, 'userinfo errors')
|
|
24
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
25
|
+
// t.equal(components.authority, "@", "authority");
|
|
26
|
+
t.equal(components.userinfo, '', 'userinfo')
|
|
27
|
+
t.equal(components.host, '', 'host')
|
|
28
|
+
t.equal(components.port, undefined, 'port')
|
|
29
|
+
t.equal(components.path, '', 'path')
|
|
30
|
+
t.equal(components.query, undefined, 'query')
|
|
31
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
32
|
+
|
|
33
|
+
// host
|
|
34
|
+
components = fastURI.parse('//')
|
|
35
|
+
t.equal(components.error, undefined, 'host errors')
|
|
36
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
37
|
+
// t.equal(components.authority, "", "authority");
|
|
38
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
39
|
+
t.equal(components.host, '', 'host')
|
|
40
|
+
t.equal(components.port, undefined, 'port')
|
|
41
|
+
t.equal(components.path, '', 'path')
|
|
42
|
+
t.equal(components.query, undefined, 'query')
|
|
43
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
44
|
+
|
|
45
|
+
// port
|
|
46
|
+
components = fastURI.parse('//:')
|
|
47
|
+
t.equal(components.error, undefined, 'port errors')
|
|
48
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
49
|
+
// t.equal(components.authority, ":", "authority");
|
|
50
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
51
|
+
t.equal(components.host, '', 'host')
|
|
52
|
+
t.equal(components.port, '', 'port')
|
|
53
|
+
t.equal(components.path, '', 'path')
|
|
54
|
+
t.equal(components.query, undefined, 'query')
|
|
55
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
56
|
+
|
|
57
|
+
// path
|
|
58
|
+
components = fastURI.parse('')
|
|
59
|
+
t.equal(components.error, undefined, 'path errors')
|
|
60
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
61
|
+
// t.equal(components.authority, undefined, "authority");
|
|
62
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
63
|
+
t.equal(components.host, undefined, 'host')
|
|
64
|
+
t.equal(components.port, undefined, 'port')
|
|
65
|
+
t.equal(components.path, '', 'path')
|
|
66
|
+
t.equal(components.query, undefined, 'query')
|
|
67
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
68
|
+
|
|
69
|
+
// query
|
|
70
|
+
components = fastURI.parse('?')
|
|
71
|
+
t.equal(components.error, undefined, 'query errors')
|
|
72
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
73
|
+
// t.equal(components.authority, undefined, "authority");
|
|
74
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
75
|
+
t.equal(components.host, undefined, 'host')
|
|
76
|
+
t.equal(components.port, undefined, 'port')
|
|
77
|
+
t.equal(components.path, '', 'path')
|
|
78
|
+
t.equal(components.query, '', 'query')
|
|
79
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
80
|
+
|
|
81
|
+
// fragment
|
|
82
|
+
components = fastURI.parse('#')
|
|
83
|
+
t.equal(components.error, undefined, 'fragment errors')
|
|
84
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
85
|
+
// t.equal(components.authority, undefined, "authority");
|
|
86
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
87
|
+
t.equal(components.host, undefined, 'host')
|
|
88
|
+
t.equal(components.port, undefined, 'port')
|
|
89
|
+
t.equal(components.path, '', 'path')
|
|
90
|
+
t.equal(components.query, undefined, 'query')
|
|
91
|
+
t.equal(components.fragment, '', 'fragment')
|
|
92
|
+
|
|
93
|
+
// fragment with character tabulation
|
|
94
|
+
components = fastURI.parse('#\t')
|
|
95
|
+
t.equal(components.error, undefined, 'path errors')
|
|
96
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
97
|
+
// t.equal(components.authority, undefined, "authority");
|
|
98
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
99
|
+
t.equal(components.host, undefined, 'host')
|
|
100
|
+
t.equal(components.port, undefined, 'port')
|
|
101
|
+
t.equal(components.path, '', 'path')
|
|
102
|
+
t.equal(components.query, undefined, 'query')
|
|
103
|
+
t.equal(components.fragment, '%09', 'fragment')
|
|
104
|
+
|
|
105
|
+
// fragment with line feed
|
|
106
|
+
components = fastURI.parse('#\n')
|
|
107
|
+
t.equal(components.error, undefined, 'path errors')
|
|
108
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
109
|
+
// t.equal(components.authority, undefined, "authority");
|
|
110
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
111
|
+
t.equal(components.host, undefined, 'host')
|
|
112
|
+
t.equal(components.port, undefined, 'port')
|
|
113
|
+
t.equal(components.path, '', 'path')
|
|
114
|
+
t.equal(components.query, undefined, 'query')
|
|
115
|
+
t.equal(components.fragment, '%0A', 'fragment')
|
|
116
|
+
|
|
117
|
+
// fragment with line tabulation
|
|
118
|
+
components = fastURI.parse('#\v')
|
|
119
|
+
t.equal(components.error, undefined, 'path errors')
|
|
120
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
121
|
+
// t.equal(components.authority, undefined, "authority");
|
|
122
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
123
|
+
t.equal(components.host, undefined, 'host')
|
|
124
|
+
t.equal(components.port, undefined, 'port')
|
|
125
|
+
t.equal(components.path, '', 'path')
|
|
126
|
+
t.equal(components.query, undefined, 'query')
|
|
127
|
+
t.equal(components.fragment, '%0B', 'fragment')
|
|
128
|
+
|
|
129
|
+
// fragment with form feed
|
|
130
|
+
components = fastURI.parse('#\f')
|
|
131
|
+
t.equal(components.error, undefined, 'path errors')
|
|
132
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
133
|
+
// t.equal(components.authority, undefined, "authority");
|
|
134
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
135
|
+
t.equal(components.host, undefined, 'host')
|
|
136
|
+
t.equal(components.port, undefined, 'port')
|
|
137
|
+
t.equal(components.path, '', 'path')
|
|
138
|
+
t.equal(components.query, undefined, 'query')
|
|
139
|
+
t.equal(components.fragment, '%0C', 'fragment')
|
|
140
|
+
|
|
141
|
+
// fragment with carriage return
|
|
142
|
+
components = fastURI.parse('#\r')
|
|
143
|
+
t.equal(components.error, undefined, 'path errors')
|
|
144
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
145
|
+
// t.equal(components.authority, undefined, "authority");
|
|
146
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
147
|
+
t.equal(components.host, undefined, 'host')
|
|
148
|
+
t.equal(components.port, undefined, 'port')
|
|
149
|
+
t.equal(components.path, '', 'path')
|
|
150
|
+
t.equal(components.query, undefined, 'query')
|
|
151
|
+
t.equal(components.fragment, '%0D', 'fragment')
|
|
152
|
+
|
|
153
|
+
// a fragment whose decoded bytes are not valid UTF-8 is still valid
|
|
154
|
+
// percent-encoding (RFC 3986 §2.1 is byte-level), so it is preserved as-is
|
|
155
|
+
// rather than being flagged as malformed
|
|
156
|
+
components = fastURI.parse('http://example.com/#%E0%A4A')
|
|
157
|
+
t.equal(components.error, undefined, 'valid percent-encoding is not flagged as malformed')
|
|
158
|
+
t.equal(components.fragment, '%E0%A4A', 'fragment is preserved')
|
|
159
|
+
|
|
160
|
+
// all
|
|
161
|
+
components = fastURI.parse('uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body')
|
|
162
|
+
t.equal(components.error, undefined, 'all errors')
|
|
163
|
+
t.equal(components.scheme, 'uri', 'scheme')
|
|
164
|
+
// t.equal(components.authority, "user:pass@example.com:123", "authority");
|
|
165
|
+
t.equal(components.userinfo, 'user:pass', 'userinfo')
|
|
166
|
+
t.equal(components.host, 'example.com', 'host')
|
|
167
|
+
t.equal(components.port, 123, 'port')
|
|
168
|
+
t.equal(components.path, '/one/two.three', 'path')
|
|
169
|
+
t.equal(components.query, 'q1=a1&q2=a2', 'query')
|
|
170
|
+
t.equal(components.fragment, 'body', 'fragment')
|
|
171
|
+
|
|
172
|
+
// IPv4address
|
|
173
|
+
components = fastURI.parse('//10.10.10.10')
|
|
174
|
+
t.equal(components.error, undefined, 'IPv4address errors')
|
|
175
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
176
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
177
|
+
t.equal(components.host, '10.10.10.10', 'host')
|
|
178
|
+
t.equal(components.port, undefined, 'port')
|
|
179
|
+
t.equal(components.path, '', 'path')
|
|
180
|
+
t.equal(components.query, undefined, 'query')
|
|
181
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
182
|
+
|
|
183
|
+
// IPv4address with unformated 0 stay as-is
|
|
184
|
+
components = fastURI.parse('//10.10.000.10') // not valid as per https://datatracker.ietf.org/doc/html/rfc5954#section-4.1
|
|
185
|
+
t.equal(components.error, undefined, 'IPv4address errors')
|
|
186
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
187
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
188
|
+
t.equal(components.host, '10.10.000.10', 'host')
|
|
189
|
+
t.equal(components.port, undefined, 'port')
|
|
190
|
+
t.equal(components.path, '', 'path')
|
|
191
|
+
t.equal(components.query, undefined, 'query')
|
|
192
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
193
|
+
components = fastURI.parse('//01.01.01.01') // not valid in URIs: https://datatracker.ietf.org/doc/html/rfc3986#section-7.4
|
|
194
|
+
t.equal(components.error, undefined, 'IPv4address errors')
|
|
195
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
196
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
197
|
+
t.equal(components.host, '01.01.01.01', 'host')
|
|
198
|
+
t.equal(components.port, undefined, 'port')
|
|
199
|
+
t.equal(components.path, '', 'path')
|
|
200
|
+
t.equal(components.query, undefined, 'query')
|
|
201
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
202
|
+
|
|
203
|
+
// IPv6address
|
|
204
|
+
components = fastURI.parse('//[2001:db8::7]')
|
|
205
|
+
t.equal(components.error, undefined, 'IPv4address errors')
|
|
206
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
207
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
208
|
+
t.equal(components.host, '2001:db8::7', 'host')
|
|
209
|
+
t.equal(components.port, undefined, 'port')
|
|
210
|
+
t.equal(components.path, '', 'path')
|
|
211
|
+
t.equal(components.query, undefined, 'query')
|
|
212
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
213
|
+
|
|
214
|
+
// invalid IPv6
|
|
215
|
+
components = fastURI.parse('//[2001:dbZ::7]')
|
|
216
|
+
t.equal(components.host, '[2001:dbz::7]')
|
|
217
|
+
|
|
218
|
+
// mixed IPv4address & IPv6address
|
|
219
|
+
components = fastURI.parse('//[::ffff:129.144.52.38]')
|
|
220
|
+
t.equal(components.error, undefined, 'IPv4address errors')
|
|
221
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
222
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
223
|
+
t.equal(components.host, '::ffff:129.144.52.38', 'host')
|
|
224
|
+
t.equal(components.port, undefined, 'port')
|
|
225
|
+
t.equal(components.path, '', 'path')
|
|
226
|
+
t.equal(components.query, undefined, 'query')
|
|
227
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
228
|
+
|
|
229
|
+
// mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4)
|
|
230
|
+
components = fastURI.parse('uri://10.10.10.10.example.com/en/process')
|
|
231
|
+
t.equal(components.error, undefined, 'mixed errors')
|
|
232
|
+
t.equal(components.scheme, 'uri', 'scheme')
|
|
233
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
234
|
+
t.equal(components.host, '10.10.10.10.example.com', 'host')
|
|
235
|
+
t.equal(components.port, undefined, 'port')
|
|
236
|
+
t.equal(components.path, '/en/process', 'path')
|
|
237
|
+
t.equal(components.query, undefined, 'query')
|
|
238
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
239
|
+
|
|
240
|
+
// IPv6address, example from bkw (https://github.com/garycourt/uri-js/pull/16)
|
|
241
|
+
components = fastURI.parse('//[2606:2800:220:1:248:1893:25c8:1946]/test')
|
|
242
|
+
t.equal(components.error, undefined, 'IPv6address errors')
|
|
243
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
244
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
245
|
+
t.equal(components.host, '2606:2800:220:1:248:1893:25c8:1946', 'host')
|
|
246
|
+
t.equal(components.port, undefined, 'port')
|
|
247
|
+
t.equal(components.path, '/test', 'path')
|
|
248
|
+
t.equal(components.query, undefined, 'query')
|
|
249
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
250
|
+
|
|
251
|
+
// IPv6address, example from RFC 5952
|
|
252
|
+
components = fastURI.parse('//[2001:db8::1]:80')
|
|
253
|
+
t.equal(components.error, undefined, 'IPv6address errors')
|
|
254
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
255
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
256
|
+
t.equal(components.host, '2001:db8::1', 'host')
|
|
257
|
+
t.equal(components.port, 80, 'port')
|
|
258
|
+
t.equal(components.path, '', 'path')
|
|
259
|
+
t.equal(components.query, undefined, 'query')
|
|
260
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
261
|
+
|
|
262
|
+
// IPv6address with zone identifier, RFC 6874
|
|
263
|
+
components = fastURI.parse('//[fe80::a%25en1]')
|
|
264
|
+
t.equal(components.error, undefined, 'IPv4address errors')
|
|
265
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
266
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
267
|
+
t.equal(components.host, 'fe80::a%en1', 'host')
|
|
268
|
+
t.equal(components.port, undefined, 'port')
|
|
269
|
+
t.equal(components.path, '', 'path')
|
|
270
|
+
t.equal(components.query, undefined, 'query')
|
|
271
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
272
|
+
|
|
273
|
+
// IPv6address with an unescaped interface specifier, example from pekkanikander (https://github.com/garycourt/uri-js/pull/22)
|
|
274
|
+
components = fastURI.parse('//[2001:db8::7%en0]')
|
|
275
|
+
t.equal(components.error, undefined, 'IPv6address interface errors')
|
|
276
|
+
t.equal(components.scheme, undefined, 'scheme')
|
|
277
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
278
|
+
t.equal(components.host, '2001:db8::7%en0', 'host')
|
|
279
|
+
t.equal(components.port, undefined, 'port')
|
|
280
|
+
t.equal(components.path, '', 'path')
|
|
281
|
+
t.equal(components.query, undefined, 'query')
|
|
282
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
283
|
+
|
|
284
|
+
// UUID V1
|
|
285
|
+
components = fastURI.parse('urn:uuid:b571b0bc-4713-11ec-81d3-0242ac130003')
|
|
286
|
+
t.equal(components.error, undefined, 'errors')
|
|
287
|
+
t.equal(components.scheme, 'urn', 'scheme')
|
|
288
|
+
// t.equal(components.authority, undefined, "authority");
|
|
289
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
290
|
+
t.equal(components.host, undefined, 'host')
|
|
291
|
+
t.equal(components.port, undefined, 'port')
|
|
292
|
+
t.equal(components.path, undefined, 'path')
|
|
293
|
+
t.equal(components.query, undefined, 'query')
|
|
294
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
295
|
+
t.equal(components.nid, 'uuid', 'nid')
|
|
296
|
+
t.equal(components.nss, undefined, 'nss')
|
|
297
|
+
t.equal(components.uuid, 'b571b0bc-4713-11ec-81d3-0242ac130003', 'uuid')
|
|
298
|
+
|
|
299
|
+
// UUID v4
|
|
300
|
+
components = fastURI.parse('urn:uuid:97a32222-89b7-420e-8507-4360723e2c2a')
|
|
301
|
+
t.equal(components.uuid, '97a32222-89b7-420e-8507-4360723e2c2a', 'uuid')
|
|
302
|
+
|
|
303
|
+
components = fastURI.parse('urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6')
|
|
304
|
+
t.notSame(components.error, undefined, 'errors')
|
|
305
|
+
|
|
306
|
+
components = fastURI.parse('urn:foo:a123,456')
|
|
307
|
+
t.equal(components.error, undefined, 'errors')
|
|
308
|
+
t.equal(components.scheme, 'urn', 'scheme')
|
|
309
|
+
// t.equal(components.authority, undefined, "authority");
|
|
310
|
+
t.equal(components.userinfo, undefined, 'userinfo')
|
|
311
|
+
t.equal(components.host, undefined, 'host')
|
|
312
|
+
t.equal(components.port, undefined, 'port')
|
|
313
|
+
t.equal(components.path, undefined, 'path')
|
|
314
|
+
t.equal(components.query, undefined, 'query')
|
|
315
|
+
t.equal(components.fragment, undefined, 'fragment')
|
|
316
|
+
t.equal(components.nid, 'foo', 'nid')
|
|
317
|
+
t.equal(components.nss, 'a123,456', 'nss')
|
|
318
|
+
|
|
319
|
+
components = fastURI.parse('//[2606:2800:220:1:248:1893:25c8:1946:43209]')
|
|
320
|
+
t.equal(components.host, '[2606:2800:220:1:248:1893:25c8:1946:43209]')
|
|
321
|
+
|
|
322
|
+
components = fastURI.parse('urn:foo:|\\24fpl')
|
|
323
|
+
t.equal(components.error, 'URN can not be parsed.')
|
|
324
|
+
t.end()
|
|
325
|
+
})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('tape')
|
|
4
|
+
const fastURI = require('..')
|
|
5
|
+
|
|
6
|
+
test('query percent-encoding is normalized (RFC 3986 §6.2.2)', (t) => {
|
|
7
|
+
// hex digits are uppercased, like the path component already does
|
|
8
|
+
t.equal(fastURI.normalize('x://h/p?a=%2a'), 'x://h/p?a=%2A', 'uppercases hex in query')
|
|
9
|
+
// unreserved characters are decoded
|
|
10
|
+
t.equal(fastURI.normalize('x://h/p?a=%7e%2e'), 'x://h/p?a=~.', 'decodes unreserved in query')
|
|
11
|
+
// reserved characters stay percent-encoded
|
|
12
|
+
t.equal(fastURI.normalize('x://h/p?a=%2F'), 'x://h/p?a=%2F', 'keeps reserved encoded in query')
|
|
13
|
+
// raw characters that are not allowed are percent-encoded
|
|
14
|
+
t.equal(fastURI.normalize('x://h/p?a b'), 'x://h/p?a%20b', 'encodes a raw space in query')
|
|
15
|
+
t.equal(fastURI.normalize('x://h/p?café'), 'x://h/p?caf%C3%A9', 'encodes raw non-ASCII in query')
|
|
16
|
+
// `?` is allowed unencoded in a query
|
|
17
|
+
t.equal(fastURI.normalize('x://h/p?a?b'), 'x://h/p?a?b', 'keeps `?` raw in query')
|
|
18
|
+
|
|
19
|
+
t.end()
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test('fragment percent-encoding is normalized without decoding reserved characters', (t) => {
|
|
23
|
+
// reserved characters must NOT be decoded — `%2F` is not `/`
|
|
24
|
+
t.equal(fastURI.normalize('x://h/p#a%2Fb%2A'), 'x://h/p#a%2Fb%2A', 'keeps reserved encoded in fragment')
|
|
25
|
+
// hex is uppercased and unreserved is decoded
|
|
26
|
+
t.equal(fastURI.normalize('x://h/p#a%2a%7e'), 'x://h/p#a%2A~', 'uppercases hex and decodes unreserved in fragment')
|
|
27
|
+
// raw characters are still encoded
|
|
28
|
+
t.equal(fastURI.normalize('x://h/p#a b'), 'x://h/p#a%20b', 'encodes a raw space in fragment')
|
|
29
|
+
// `?` and `/` are allowed unencoded in a fragment
|
|
30
|
+
t.equal(fastURI.normalize('x://h/p#f?x/y'), 'x://h/p#f?x/y', 'keeps `?` and `/` raw in fragment')
|
|
31
|
+
|
|
32
|
+
t.end()
|
|
33
|
+
})
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('tape')
|
|
4
|
+
const fastURI = require('..')
|
|
5
|
+
|
|
6
|
+
test('URI Resolving', (t) => {
|
|
7
|
+
// normal examples from RFC 3986
|
|
8
|
+
const base = 'uri://a/b/c/d;p?q'
|
|
9
|
+
t.equal(fastURI.resolve(base, 'g:h'), 'g:h', 'g:h')
|
|
10
|
+
t.equal(fastURI.resolve(base, 'g:h'), 'g:h', 'g:h')
|
|
11
|
+
t.equal(fastURI.resolve(base, 'g'), 'uri://a/b/c/g', 'g')
|
|
12
|
+
t.equal(fastURI.resolve(base, './g'), 'uri://a/b/c/g', './g')
|
|
13
|
+
t.equal(fastURI.resolve(base, 'g/'), 'uri://a/b/c/g/', 'g/')
|
|
14
|
+
t.equal(fastURI.resolve(base, '/g'), 'uri://a/g', '/g')
|
|
15
|
+
t.equal(fastURI.resolve(base, '//g'), 'uri://g', '//g')
|
|
16
|
+
t.equal(fastURI.resolve(base, '?y'), 'uri://a/b/c/d;p?y', '?y')
|
|
17
|
+
t.equal(fastURI.resolve(base, 'g?y'), 'uri://a/b/c/g?y', 'g?y')
|
|
18
|
+
t.equal(fastURI.resolve(base, '#s'), 'uri://a/b/c/d;p?q#s', '#s')
|
|
19
|
+
t.equal(fastURI.resolve(base, 'g#s'), 'uri://a/b/c/g#s', 'g#s')
|
|
20
|
+
t.equal(fastURI.resolve(base, 'g?y#s'), 'uri://a/b/c/g?y#s', 'g?y#s')
|
|
21
|
+
t.equal(fastURI.resolve(base, ';x'), 'uri://a/b/c/;x', ';x')
|
|
22
|
+
t.equal(fastURI.resolve(base, 'g;x'), 'uri://a/b/c/g;x', 'g;x')
|
|
23
|
+
t.equal(fastURI.resolve(base, 'g;x?y#s'), 'uri://a/b/c/g;x?y#s', 'g;x?y#s')
|
|
24
|
+
t.equal(fastURI.resolve(base, ''), 'uri://a/b/c/d;p?q', '')
|
|
25
|
+
t.equal(fastURI.resolve(base, '.'), 'uri://a/b/c/', '.')
|
|
26
|
+
t.equal(fastURI.resolve(base, './'), 'uri://a/b/c/', './')
|
|
27
|
+
t.equal(fastURI.resolve(base, '..'), 'uri://a/b/', '..')
|
|
28
|
+
t.equal(fastURI.resolve(base, '../'), 'uri://a/b/', '../')
|
|
29
|
+
t.equal(fastURI.resolve(base, '../g'), 'uri://a/b/g', '../g')
|
|
30
|
+
t.equal(fastURI.resolve(base, '../..'), 'uri://a/', '../..')
|
|
31
|
+
t.equal(fastURI.resolve(base, '../../'), 'uri://a/', '../../')
|
|
32
|
+
t.equal(fastURI.resolve(base, '../../g'), 'uri://a/g', '../../g')
|
|
33
|
+
|
|
34
|
+
// abnormal examples from RFC 3986
|
|
35
|
+
t.equal(fastURI.resolve(base, '../../../g'), 'uri://a/g', '../../../g')
|
|
36
|
+
t.equal(fastURI.resolve(base, '../../../../g'), 'uri://a/g', '../../../../g')
|
|
37
|
+
|
|
38
|
+
t.equal(fastURI.resolve(base, '/./g'), 'uri://a/g', '/./g')
|
|
39
|
+
t.equal(fastURI.resolve(base, '/../g'), 'uri://a/g', '/../g')
|
|
40
|
+
t.equal(fastURI.resolve(base, 'g.'), 'uri://a/b/c/g.', 'g.')
|
|
41
|
+
t.equal(fastURI.resolve(base, '.g'), 'uri://a/b/c/.g', '.g')
|
|
42
|
+
t.equal(fastURI.resolve(base, 'g..'), 'uri://a/b/c/g..', 'g..')
|
|
43
|
+
t.equal(fastURI.resolve(base, '..g'), 'uri://a/b/c/..g', '..g')
|
|
44
|
+
|
|
45
|
+
t.equal(fastURI.resolve(base, './../g'), 'uri://a/b/g', './../g')
|
|
46
|
+
t.equal(fastURI.resolve(base, './g/.'), 'uri://a/b/c/g/', './g/.')
|
|
47
|
+
t.equal(fastURI.resolve(base, 'g/./h'), 'uri://a/b/c/g/h', 'g/./h')
|
|
48
|
+
t.equal(fastURI.resolve(base, 'g/../h'), 'uri://a/b/c/h', 'g/../h')
|
|
49
|
+
t.equal(fastURI.resolve(base, 'g;x=1/./y'), 'uri://a/b/c/g;x=1/y', 'g;x=1/./y')
|
|
50
|
+
t.equal(fastURI.resolve(base, 'g;x=1/../y'), 'uri://a/b/c/y', 'g;x=1/../y')
|
|
51
|
+
|
|
52
|
+
t.equal(fastURI.resolve(base, 'g?y/./x'), 'uri://a/b/c/g?y/./x', 'g?y/./x')
|
|
53
|
+
t.equal(fastURI.resolve(base, 'g?y/../x'), 'uri://a/b/c/g?y/../x', 'g?y/../x')
|
|
54
|
+
t.equal(fastURI.resolve(base, 'g#s/./x'), 'uri://a/b/c/g#s/./x', 'g#s/./x')
|
|
55
|
+
t.equal(fastURI.resolve(base, 'g#s/../x'), 'uri://a/b/c/g#s/../x', 'g#s/../x')
|
|
56
|
+
|
|
57
|
+
t.equal(fastURI.resolve(base, 'uri:g'), 'uri:g', 'uri:g')
|
|
58
|
+
t.equal(fastURI.resolve(base, 'uri:g', {}), 'uri:g', 'uri:g')
|
|
59
|
+
t.equal(fastURI.resolve(base, 'uri:g', { tolerant: undefined }), 'uri:g', 'uri:g')
|
|
60
|
+
t.equal(fastURI.resolve(base, 'uri:g', { tolerant: false }), 'uri:g', 'uri:g')
|
|
61
|
+
t.equal(fastURI.resolve(base, 'uri:g', { tolerant: true }), 'uri://a/b/c/g', 'uri:g')
|
|
62
|
+
|
|
63
|
+
// examples by PAEz
|
|
64
|
+
// example was provided to avoid infinite loop within regex
|
|
65
|
+
// this is not the case anymore
|
|
66
|
+
// t.equal(URI.resolve('//www.g.com/', '/adf\ngf'), '//www.g.com/adf%0Agf', '/adf\\ngf')
|
|
67
|
+
// t.equal(URI.resolve('//www.g.com/error\n/bleh/bleh', '..'), '//www.g.com/error%0A/', '//www.g.com/error\\n/bleh/bleh')
|
|
68
|
+
t.end()
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
test('URN Resolving', (t) => {
|
|
72
|
+
// example from epoberezkin
|
|
73
|
+
t.equal(fastURI.resolve('', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
|
|
74
|
+
t.equal(fastURI.resolve('#', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
|
|
75
|
+
t.equal(fastURI.resolve('urn:some:ip:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
|
|
76
|
+
t.equal(fastURI.resolve('urn:some:other:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
|
|
77
|
+
t.end()
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
test('URI Resolving tolerates malformed fragments', (t) => {
|
|
81
|
+
t.equal(
|
|
82
|
+
fastURI.resolve('http://base.com/', 'http://example.com/#%E0%A4A'),
|
|
83
|
+
'http://example.com/#%E0%A4A',
|
|
84
|
+
'malformed fragment does not throw during resolve'
|
|
85
|
+
)
|
|
86
|
+
t.end()
|
|
87
|
+
})
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('tape')
|
|
4
|
+
const fastURI = require('..')
|
|
5
|
+
|
|
6
|
+
test('RFC 3986', (t) => {
|
|
7
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/', secure: true }),
|
|
8
|
+
'http://example.com/', 'http://example.com/')
|
|
9
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo', secure: true }),
|
|
10
|
+
'http://example.com/foo', 'http://example.com/foo')
|
|
11
|
+
|
|
12
|
+
// A. If the input buffer begins with a prefix of "../" or "./",
|
|
13
|
+
// then remove that prefix from the input buffer; otherwise,
|
|
14
|
+
|
|
15
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../', secure: true }),
|
|
16
|
+
'http://example.com/', 'http://example.com/')
|
|
17
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './', secure: true }),
|
|
18
|
+
'http://example.com/', 'http://example.com/')
|
|
19
|
+
|
|
20
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../../', secure: true }),
|
|
21
|
+
'http://example.com/', 'http://example.com/')
|
|
22
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '././', secure: true }),
|
|
23
|
+
'http://example.com/', 'http://example.com/')
|
|
24
|
+
|
|
25
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './../', secure: true }),
|
|
26
|
+
'http://example.com/', 'http://example.com/')
|
|
27
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '.././', secure: true }),
|
|
28
|
+
'http://example.com/', 'http://example.com/')
|
|
29
|
+
|
|
30
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../foo', secure: true }),
|
|
31
|
+
'http://example.com/foo', 'http://example.com/foo')
|
|
32
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './foo', secure: true }),
|
|
33
|
+
'http://example.com/foo', 'http://example.com/foo')
|
|
34
|
+
|
|
35
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../../foo', secure: true }),
|
|
36
|
+
'http://example.com/foo', 'http://example.com/foo')
|
|
37
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '././foo', secure: true }),
|
|
38
|
+
'http://example.com/foo', 'http://example.com/foo')
|
|
39
|
+
|
|
40
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './../foo', secure: true }),
|
|
41
|
+
'http://example.com/foo', 'http://example.com/foo')
|
|
42
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '.././foo', secure: true }),
|
|
43
|
+
'http://example.com/foo', 'http://example.com/foo')
|
|
44
|
+
|
|
45
|
+
// B. if the input buffer begins with a prefix of "/./" or "/.",
|
|
46
|
+
// where "." is a complete path segment, then replace that
|
|
47
|
+
// prefix with "/" in the input buffer; otherwise,
|
|
48
|
+
|
|
49
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/./', secure: true }),
|
|
50
|
+
'http://example.com/', 'http://example.com/')
|
|
51
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/.', secure: true }),
|
|
52
|
+
'http://example.com/', 'http://example.com/')
|
|
53
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/./foo', secure: true }),
|
|
54
|
+
'http://example.com/foo', 'http://example.com/foo')
|
|
55
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/.././foo', secure: true }),
|
|
56
|
+
'http://example.com/foo', 'http://example.com/foo')
|
|
57
|
+
|
|
58
|
+
// C. if the input buffer begins with a prefix of "/../" or "/..",
|
|
59
|
+
// where ".." is a complete path segment, then replace that
|
|
60
|
+
// prefix with "/" in the input buffer and remove the last
|
|
61
|
+
// segment and its preceding "/" (if any) from the output
|
|
62
|
+
// buffer; otherwise,
|
|
63
|
+
|
|
64
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/../', secure: true }),
|
|
65
|
+
'http://example.com/', 'http://example.com/')
|
|
66
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/..', secure: true }),
|
|
67
|
+
'http://example.com/', 'http://example.com/')
|
|
68
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/../foo', secure: true }),
|
|
69
|
+
'http://example.com/foo', 'http://example.com/foo')
|
|
70
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo/..', secure: true }),
|
|
71
|
+
'http://example.com/', 'http://example.com/')
|
|
72
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo/bar/..', secure: true }),
|
|
73
|
+
'http://example.com/foo/', 'http://example.com/foo/')
|
|
74
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo/../bar/..', secure: true }),
|
|
75
|
+
'http://example.com/', 'http://example.com/')
|
|
76
|
+
|
|
77
|
+
// D. if the input buffer consists only of "." or "..", then remove
|
|
78
|
+
// that from the input buffer; otherwise,
|
|
79
|
+
|
|
80
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/.', secure: true }),
|
|
81
|
+
'http://example.com/', 'http://example.com/')
|
|
82
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/..', secure: true }),
|
|
83
|
+
'http://example.com/', 'http://example.com/')
|
|
84
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '.', secure: true }),
|
|
85
|
+
'http://example.com/', 'http://example.com/')
|
|
86
|
+
t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '..', secure: true }),
|
|
87
|
+
'http://example.com/', 'http://example.com/')
|
|
88
|
+
|
|
89
|
+
t.end()
|
|
90
|
+
})
|