@quintype/framework 7.18.8 → 7.18.9-support-inline-js.0
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/package.json
CHANGED
|
@@ -20,7 +20,7 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
|
|
|
20
20
|
res.setHeader(
|
|
21
21
|
"Content-Security-Policy",
|
|
22
22
|
`default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
|
|
23
|
-
`script-src data: 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
23
|
+
`script-src data: 'update-hashes' 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
24
24
|
`style-src data: 'unsafe-inline' https: http: blob:;` +
|
|
25
25
|
`img-src data: https: http: blob:;` +
|
|
26
26
|
`font-src data: https: http:;` +
|
|
@@ -60,7 +60,7 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
|
|
|
60
60
|
res.setHeader(
|
|
61
61
|
"Content-Security-Policy",
|
|
62
62
|
`default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
|
|
63
|
-
`script-src data: 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
63
|
+
`script-src data: 'update-hashes' 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
64
64
|
`style-src data: 'unsafe-inline' https: http: blob:;` +
|
|
65
65
|
`img-src data: https: http: blob:;` +
|
|
66
66
|
`font-src data: https: http:;` +
|
|
@@ -80,7 +80,7 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
|
|
|
80
80
|
res.setHeader(
|
|
81
81
|
"Content-Security-Policy",
|
|
82
82
|
`default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
|
|
83
|
-
`script-src data: 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
83
|
+
`script-src data: 'update-hashes' 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
84
84
|
`style-src data: 'unsafe-inline' https: http: blob:;` +
|
|
85
85
|
`img-src data: https: http: blob:;` +
|
|
86
86
|
`font-src data: https: http:;` +
|
|
@@ -53,8 +53,7 @@ function createApp(loadData, routes, opts = {}, app = express()) {
|
|
|
53
53
|
describe("Isomorphic Handler", function () {
|
|
54
54
|
it("Renders the page if the route matches", function (done) {
|
|
55
55
|
const app = createApp(
|
|
56
|
-
(pageType, params, config, client, { host }) =>
|
|
57
|
-
Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
56
|
+
(pageType, params, config, client, { host }) => Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
58
57
|
[{ pageType: "home-page", path: "/", exact: true }]
|
|
59
58
|
);
|
|
60
59
|
|
|
@@ -64,10 +63,7 @@ describe("Isomorphic Handler", function () {
|
|
|
64
63
|
.expect(200)
|
|
65
64
|
.then((res) => {
|
|
66
65
|
const response = JSON.parse(res.text);
|
|
67
|
-
assert.equal(
|
|
68
|
-
'<div data-page-type="home-page">foobar</div>',
|
|
69
|
-
response.content
|
|
70
|
-
);
|
|
66
|
+
assert.equal('<div data-page-type="home-page">foobar</div>', response.content);
|
|
71
67
|
assert.equal("foobar", response.store.qt.data.text);
|
|
72
68
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
73
69
|
assert.equal("home-page", response.store.qt.pageType);
|
|
@@ -77,8 +73,7 @@ describe("Isomorphic Handler", function () {
|
|
|
77
73
|
|
|
78
74
|
it("Accepts an async pickComponent function", function (done) {
|
|
79
75
|
const app = createApp(
|
|
80
|
-
(pageType, params, config, client, { host }) =>
|
|
81
|
-
Promise.resolve({ pageType, data: { text: "foobar" } }),
|
|
76
|
+
(pageType, params, config, client, { host }) => Promise.resolve({ pageType, data: { text: "foobar" } }),
|
|
82
77
|
[{ pageType: "home-page", path: "/" }],
|
|
83
78
|
{
|
|
84
79
|
pickComponent: (pageType) => Promise.resolve(pickComponent(pageType)),
|
|
@@ -91,18 +86,14 @@ describe("Isomorphic Handler", function () {
|
|
|
91
86
|
.expect(200)
|
|
92
87
|
.then((res) => {
|
|
93
88
|
const response = JSON.parse(res.text);
|
|
94
|
-
assert.equal(
|
|
95
|
-
'<div data-page-type="home-page">foobar</div>',
|
|
96
|
-
response.content
|
|
97
|
-
);
|
|
89
|
+
assert.equal('<div data-page-type="home-page">foobar</div>', response.content);
|
|
98
90
|
})
|
|
99
91
|
.then(done);
|
|
100
92
|
});
|
|
101
93
|
|
|
102
94
|
it("Passes all URL parameters to the load data function", function (done) {
|
|
103
95
|
const app = createApp(
|
|
104
|
-
(pageType, params, config, client) =>
|
|
105
|
-
Promise.resolve({ pageType, data: { text: params.text } }),
|
|
96
|
+
(pageType, params, config, client) => Promise.resolve({ pageType, data: { text: params.text } }),
|
|
106
97
|
[{ pageType: "home-page", path: "/" }]
|
|
107
98
|
);
|
|
108
99
|
|
|
@@ -120,8 +111,7 @@ describe("Isomorphic Handler", function () {
|
|
|
120
111
|
describe("preloading", function () {
|
|
121
112
|
it("preloads the app.js", function (done) {
|
|
122
113
|
const app = createApp(
|
|
123
|
-
(pageType, params, config, client) =>
|
|
124
|
-
Promise.resolve({ pageType, data: { text: "foobar" } }),
|
|
114
|
+
(pageType, params, config, client) => Promise.resolve({ pageType, data: { text: "foobar" } }),
|
|
125
115
|
[{ pageType: "home-page", path: "/" }],
|
|
126
116
|
{
|
|
127
117
|
preloadJs: true,
|
|
@@ -155,10 +145,7 @@ describe("Isomorphic Handler", function () {
|
|
|
155
145
|
.expect(404)
|
|
156
146
|
.then((res) => {
|
|
157
147
|
const response = JSON.parse(res.text);
|
|
158
|
-
assert.equal(
|
|
159
|
-
'<div data-page-type="not-found">foobar</div>',
|
|
160
|
-
response.content
|
|
161
|
-
);
|
|
148
|
+
assert.equal('<div data-page-type="not-found">foobar</div>', response.content);
|
|
162
149
|
assert.equal(false, response.store.qt.disableIsomorphicComponent);
|
|
163
150
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
164
151
|
})
|
|
@@ -186,10 +173,7 @@ describe("Isomorphic Handler", function () {
|
|
|
186
173
|
.expect(500)
|
|
187
174
|
.then((res) => {
|
|
188
175
|
const response = JSON.parse(res.text);
|
|
189
|
-
assert.equal(
|
|
190
|
-
'<div data-page-type="not-found">foobar</div>',
|
|
191
|
-
response.content
|
|
192
|
-
);
|
|
176
|
+
assert.equal('<div data-page-type="not-found">foobar</div>', response.content);
|
|
193
177
|
assert.equal(true, response.store.qt.disableIsomorphicComponent);
|
|
194
178
|
})
|
|
195
179
|
.then(done, done);
|
|
@@ -224,10 +208,7 @@ describe("Isomorphic Handler", function () {
|
|
|
224
208
|
supertest(app)
|
|
225
209
|
.get("/")
|
|
226
210
|
.expect("Content-Type", /html/)
|
|
227
|
-
.expect(
|
|
228
|
-
"Cache-Control",
|
|
229
|
-
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
230
|
-
)
|
|
211
|
+
.expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
|
|
231
212
|
.expect("Vary", "Accept-Encoding")
|
|
232
213
|
.expect("Surrogate-Key", "foo bar")
|
|
233
214
|
.expect("Cache-Tag", "foo,bar")
|
|
@@ -236,8 +217,7 @@ describe("Isomorphic Handler", function () {
|
|
|
236
217
|
|
|
237
218
|
it("it redirects on a 301", function (done) {
|
|
238
219
|
const app = createApp(
|
|
239
|
-
(pageType, params, config, client) =>
|
|
240
|
-
Promise.resolve({ httpStatusCode: 301, data: { location: "/foobar" } }),
|
|
220
|
+
(pageType, params, config, client) => Promise.resolve({ httpStatusCode: 301, data: { location: "/foobar" } }),
|
|
241
221
|
[{ pageType: "home-page", path: "/" }]
|
|
242
222
|
);
|
|
243
223
|
|
|
@@ -246,8 +226,7 @@ describe("Isomorphic Handler", function () {
|
|
|
246
226
|
|
|
247
227
|
it("returns a 500 if render layout crashes", function (done) {
|
|
248
228
|
const app = createApp(
|
|
249
|
-
(pageType, params, config, client) =>
|
|
250
|
-
Promise.resolve({ pageType, data: { text: "foobar" } }),
|
|
229
|
+
(pageType, params, config, client) => Promise.resolve({ pageType, data: { text: "foobar" } }),
|
|
251
230
|
[{ pageType: "home-page", path: "/" }],
|
|
252
231
|
{
|
|
253
232
|
renderLayout: () => {
|
|
@@ -267,8 +246,7 @@ describe("Isomorphic Handler", function () {
|
|
|
267
246
|
});
|
|
268
247
|
|
|
269
248
|
const app = createApp(
|
|
270
|
-
(pageType, params, config, client) =>
|
|
271
|
-
Promise.resolve({ pageType, data: { text: "foobar" } }),
|
|
249
|
+
(pageType, params, config, client) => Promise.resolve({ pageType, data: { text: "foobar" } }),
|
|
272
250
|
[{ pageType: "home-page", path: "/" }],
|
|
273
251
|
{
|
|
274
252
|
prerenderServiceUrl: "http://localhost:4000",
|
|
@@ -337,10 +315,7 @@ describe("Isomorphic Handler", function () {
|
|
|
337
315
|
.expect(404)
|
|
338
316
|
.then((res) => {
|
|
339
317
|
const response = JSON.parse(res.text);
|
|
340
|
-
assert.equal(
|
|
341
|
-
'<div data-page-type="not-found">foobar</div>',
|
|
342
|
-
response.content
|
|
343
|
-
);
|
|
318
|
+
assert.equal('<div data-page-type="not-found">foobar</div>', response.content);
|
|
344
319
|
assert.equal(false, response.store.qt.disableIsomorphicComponent);
|
|
345
320
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
346
321
|
})
|
|
@@ -349,8 +324,7 @@ describe("Isomorphic Handler", function () {
|
|
|
349
324
|
|
|
350
325
|
it("Allows bypassing even data.abort is set", function (done) {
|
|
351
326
|
const app = createApp(
|
|
352
|
-
(pageType, params, config, client, { next }) =>
|
|
353
|
-
next().then((n) => ({ data: n })),
|
|
327
|
+
(pageType, params, config, client, { next }) => next().then((n) => ({ data: n })),
|
|
354
328
|
[{ pageType: "home-page", path: "/skip", exact: true }],
|
|
355
329
|
{
|
|
356
330
|
loadErrorData: (err, config, client, { host }) => ({
|
|
@@ -367,10 +341,7 @@ describe("Isomorphic Handler", function () {
|
|
|
367
341
|
.expect(404)
|
|
368
342
|
.then((res) => {
|
|
369
343
|
const response = JSON.parse(res.text);
|
|
370
|
-
assert.equal(
|
|
371
|
-
'<div data-page-type="not-found">foobar</div>',
|
|
372
|
-
response.content
|
|
373
|
-
);
|
|
344
|
+
assert.equal('<div data-page-type="not-found">foobar</div>', response.content);
|
|
374
345
|
assert.equal(false, response.store.qt.disableIsomorphicComponent);
|
|
375
346
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
376
347
|
})
|
|
@@ -383,9 +354,7 @@ describe("Isomorphic Handler", function () {
|
|
|
383
354
|
{ pageType: "home-page", path: "/" },
|
|
384
355
|
];
|
|
385
356
|
const dataLoader = (pageType, _1, _2, _3, { host, next }) =>
|
|
386
|
-
pageType === "skip"
|
|
387
|
-
? next()
|
|
388
|
-
: Promise.resolve({ pageType, data: { text: "foobar", host } });
|
|
357
|
+
pageType === "skip" ? next() : Promise.resolve({ pageType, data: { text: "foobar", host } });
|
|
389
358
|
|
|
390
359
|
const app = createApp(dataLoader, overlappingRoutes);
|
|
391
360
|
|
|
@@ -395,10 +364,7 @@ describe("Isomorphic Handler", function () {
|
|
|
395
364
|
.expect(200)
|
|
396
365
|
.then((res) => {
|
|
397
366
|
const response = JSON.parse(res.text);
|
|
398
|
-
assert.equal(
|
|
399
|
-
'<div data-page-type="home-page">foobar</div>',
|
|
400
|
-
response.content
|
|
401
|
-
);
|
|
367
|
+
assert.equal('<div data-page-type="home-page">foobar</div>', response.content);
|
|
402
368
|
assert.equal("foobar", response.store.qt.data.text);
|
|
403
369
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
404
370
|
assert.equal("home-page", response.store.qt.pageType);
|
|
@@ -409,8 +375,7 @@ describe("Isomorphic Handler", function () {
|
|
|
409
375
|
|
|
410
376
|
it("Passes the primaryHostUrl and currentHostUrl to the render", function (done) {
|
|
411
377
|
const app = createApp(
|
|
412
|
-
(pageType, params, config, client, { host }) =>
|
|
413
|
-
Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
378
|
+
(pageType, params, config, client, { host }) => Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
414
379
|
[{ pageType: "home-page", path: "/" }]
|
|
415
380
|
);
|
|
416
381
|
|
|
@@ -445,10 +410,7 @@ describe("Isomorphic Handler", function () {
|
|
|
445
410
|
.expect("Content-Type", /html/)
|
|
446
411
|
.expect(200)
|
|
447
412
|
.then((res) => {
|
|
448
|
-
assert.equal(
|
|
449
|
-
`http://127.0.0.1/amp/story/%2Ffoo%2Fbar`,
|
|
450
|
-
res.get("X-QT-Light-Pages-Url")
|
|
451
|
-
);
|
|
413
|
+
assert.equal(`http://127.0.0.1/amp/story/%2Ffoo%2Fbar`, res.get("X-QT-Light-Pages-Url"));
|
|
452
414
|
})
|
|
453
415
|
.then(done);
|
|
454
416
|
});
|
|
@@ -471,10 +433,7 @@ describe("Isomorphic Handler", function () {
|
|
|
471
433
|
.expect("Content-Type", /html/)
|
|
472
434
|
.expect(200)
|
|
473
435
|
.then((res) => {
|
|
474
|
-
assert.equal(
|
|
475
|
-
`http://127.0.0.1/amp/story/%2Ffoo%2Fbar`,
|
|
476
|
-
res.get("X-QT-Light-Pages-Url")
|
|
477
|
-
);
|
|
436
|
+
assert.equal(`http://127.0.0.1/amp/story/%2Ffoo%2Fbar`, res.get("X-QT-Light-Pages-Url"));
|
|
478
437
|
})
|
|
479
438
|
.then(done);
|
|
480
439
|
});
|
|
@@ -489,8 +448,7 @@ describe("Isomorphic Handler", function () {
|
|
|
489
448
|
[{ pageType: "story-page", path: "/*/:storySlug" }],
|
|
490
449
|
{
|
|
491
450
|
lightPages: () => false,
|
|
492
|
-
renderLightPage: (req, res, result) =>
|
|
493
|
-
res.send("<h1> Amp Page </h1>"),
|
|
451
|
+
renderLightPage: (req, res, result) => res.send("<h1> Amp Page </h1>"),
|
|
494
452
|
shouldEncodeAmpUri: true,
|
|
495
453
|
}
|
|
496
454
|
);
|
|
@@ -553,10 +511,7 @@ describe("Isomorphic Handler", function () {
|
|
|
553
511
|
.then((res) => {
|
|
554
512
|
const cacheControl = res.header["cache-control"];
|
|
555
513
|
const cacheTag = res.header["cache-tag"];
|
|
556
|
-
assert.equal(
|
|
557
|
-
cacheControl,
|
|
558
|
-
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
559
|
-
);
|
|
514
|
+
assert.equal(cacheControl, "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400");
|
|
560
515
|
assert.equal(cacheTag, "c/1/abcdefgh");
|
|
561
516
|
})
|
|
562
517
|
.then(done);
|
|
@@ -579,10 +534,7 @@ describe("Isomorphic Handler", function () {
|
|
|
579
534
|
.then((res) => {
|
|
580
535
|
const cacheControl = res.header["cache-control"];
|
|
581
536
|
const cacheTag = res.header["cache-tag"];
|
|
582
|
-
assert.equal(
|
|
583
|
-
cacheControl,
|
|
584
|
-
"public,max-age=15,s-maxage=60,stale-while-revalidate=150,stale-if-error=3600"
|
|
585
|
-
);
|
|
537
|
+
assert.equal(cacheControl, "public,max-age=15,s-maxage=60,stale-while-revalidate=150,stale-if-error=3600");
|
|
586
538
|
assert.equal(cacheTag, undefined);
|
|
587
539
|
})
|
|
588
540
|
.then(done);
|
|
@@ -616,7 +568,7 @@ describe("Isomorphic Handler", function () {
|
|
|
616
568
|
assert.equal(
|
|
617
569
|
contentSecurityPolicy,
|
|
618
570
|
`default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
|
|
619
|
-
`script-src data: 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
571
|
+
`script-src data: 'update-hashes' 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
620
572
|
`style-src data: 'unsafe-inline' https: http: blob:;` +
|
|
621
573
|
`img-src data: https: http: blob:;` +
|
|
622
574
|
`font-src data: https: http:;` +
|
|
@@ -651,19 +603,13 @@ describe("Isomorphic Handler", function () {
|
|
|
651
603
|
const edgeCacheControl = res.header["edge-control"];
|
|
652
604
|
const edgeCacheTag = res.header["edge-cache-tag"];
|
|
653
605
|
const contentSecurityPolicy = res.header["content-security-policy"];
|
|
654
|
-
assert.equal(
|
|
655
|
-
|
|
656
|
-
"public,max-age=15,s-maxage=60,stale-while-revalidate=150,stale-if-error=3600"
|
|
657
|
-
);
|
|
658
|
-
assert.equal(
|
|
659
|
-
edgeCacheControl,
|
|
660
|
-
"public,maxage=60,stale-while-revalidate=150,stale-if-error=3600"
|
|
661
|
-
);
|
|
606
|
+
assert.equal(cacheControl, "public,max-age=15,s-maxage=60,stale-while-revalidate=150,stale-if-error=3600");
|
|
607
|
+
assert.equal(edgeCacheControl, "public,maxage=60,stale-while-revalidate=150,stale-if-error=3600");
|
|
662
608
|
assert.equal(edgeCacheTag, undefined);
|
|
663
609
|
assert.equal(
|
|
664
610
|
contentSecurityPolicy,
|
|
665
611
|
`default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
|
|
666
|
-
`script-src data: 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
612
|
+
`script-src data: 'update-hashes' 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
667
613
|
`style-src data: 'unsafe-inline' https: http: blob:;` +
|
|
668
614
|
`img-src data: https: http: blob:;` +
|
|
669
615
|
`font-src data: https: http:;` +
|
|
@@ -698,19 +644,13 @@ describe("Isomorphic Handler", function () {
|
|
|
698
644
|
const edgeCacheControl = res.header["edge-control"];
|
|
699
645
|
const edgeCacheTag = res.header["edge-cache-tag"];
|
|
700
646
|
const contentSecurityPolicy = res.header["content-security-policy"];
|
|
701
|
-
assert.equal(
|
|
702
|
-
|
|
703
|
-
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
704
|
-
);
|
|
705
|
-
assert.equal(
|
|
706
|
-
edgeCacheControl,
|
|
707
|
-
"public,maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
708
|
-
);
|
|
647
|
+
assert.equal(cacheControl, "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400");
|
|
648
|
+
assert.equal(edgeCacheControl, "public,maxage=900,stale-while-revalidate=1000,stale-if-error=14400");
|
|
709
649
|
assert.equal(edgeCacheTag, "c/1/abcdefgh");
|
|
710
650
|
assert.equal(
|
|
711
651
|
contentSecurityPolicy,
|
|
712
652
|
`default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
|
|
713
|
-
`script-src data: 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
653
|
+
`script-src data: 'update-hashes' 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
714
654
|
`style-src data: 'unsafe-inline' https: http: blob:;` +
|
|
715
655
|
`img-src data: https: http: blob:;` +
|
|
716
656
|
`font-src data: https: http:;` +
|
|
@@ -745,19 +685,13 @@ describe("Isomorphic Handler", function () {
|
|
|
745
685
|
const edgeCacheControl = res.header["edge-control"];
|
|
746
686
|
const edgeCacheTag = res.header["edge-cache-tag"];
|
|
747
687
|
const contentSecurityPolicy = res.header["content-security-policy"];
|
|
748
|
-
assert.equal(
|
|
749
|
-
|
|
750
|
-
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
751
|
-
);
|
|
752
|
-
assert.equal(
|
|
753
|
-
edgeCacheControl,
|
|
754
|
-
"public,maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
755
|
-
);
|
|
688
|
+
assert.equal(cacheControl, "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400");
|
|
689
|
+
assert.equal(edgeCacheControl, "public,maxage=900,stale-while-revalidate=1000,stale-if-error=14400");
|
|
756
690
|
assert.equal(edgeCacheTag, "c/1/abcdefgh");
|
|
757
691
|
assert.equal(
|
|
758
692
|
contentSecurityPolicy,
|
|
759
693
|
`default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
|
|
760
|
-
`script-src data: 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
694
|
+
`script-src data: 'update-hashes' 'unsafe-inline' 'unsafe-eval' https: http: blob:;` +
|
|
761
695
|
`style-src data: 'unsafe-inline' https: http: blob:;` +
|
|
762
696
|
`img-src data: https: http: blob:;` +
|
|
763
697
|
`font-src data: https: http:;` +
|
|
@@ -812,10 +746,7 @@ describe("Isomorphic Handler", function () {
|
|
|
812
746
|
.expect(200)
|
|
813
747
|
.then((res) => {
|
|
814
748
|
const cacheControl = res.header["cache-control"];
|
|
815
|
-
assert.equal(
|
|
816
|
-
cacheControl,
|
|
817
|
-
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
|
|
818
|
-
);
|
|
749
|
+
assert.equal(cacheControl, "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400");
|
|
819
750
|
})
|
|
820
751
|
.then(done);
|
|
821
752
|
});
|
|
@@ -917,8 +848,7 @@ describe("Isomorphic Handler", function () {
|
|
|
917
848
|
const app = express();
|
|
918
849
|
mountQuintypeAt(app, "/foo");
|
|
919
850
|
createApp(
|
|
920
|
-
(pageType, params, config, client, { host }) =>
|
|
921
|
-
Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
851
|
+
(pageType, params, config, client, { host }) => Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
922
852
|
[{ pageType: "home-page", path: "/", exact: true }],
|
|
923
853
|
{},
|
|
924
854
|
app
|
|
@@ -930,10 +860,7 @@ describe("Isomorphic Handler", function () {
|
|
|
930
860
|
.expect(200)
|
|
931
861
|
.then((res) => {
|
|
932
862
|
const response = JSON.parse(res.text);
|
|
933
|
-
assert.equal(
|
|
934
|
-
'<div data-page-type="home-page">foobar</div>',
|
|
935
|
-
response.content
|
|
936
|
-
);
|
|
863
|
+
assert.equal('<div data-page-type="home-page">foobar</div>', response.content);
|
|
937
864
|
assert.equal("foobar", response.store.qt.data.text);
|
|
938
865
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
939
866
|
assert.equal("home-page", response.store.qt.pageType);
|
|
@@ -944,8 +871,7 @@ describe("Isomorphic Handler", function () {
|
|
|
944
871
|
const app = express();
|
|
945
872
|
mountQuintypeAt(app, "/foo");
|
|
946
873
|
createApp(
|
|
947
|
-
(pageType, params, config, client, { host }) =>
|
|
948
|
-
Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
874
|
+
(pageType, params, config, client, { host }) => Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
949
875
|
[{ pageType: "home-page", path: "/", exact: true }],
|
|
950
876
|
{},
|
|
951
877
|
app
|
|
@@ -958,8 +884,7 @@ describe("Isomorphic Handler", function () {
|
|
|
958
884
|
const app = express();
|
|
959
885
|
mountQuintypeAt(app, (hostname) => `/${hostname}`);
|
|
960
886
|
createApp(
|
|
961
|
-
(pageType, params, config, client, { host }) =>
|
|
962
|
-
Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
887
|
+
(pageType, params, config, client, { host }) => Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
963
888
|
[{ pageType: "home-page", path: "/", exact: true }],
|
|
964
889
|
{},
|
|
965
890
|
app
|
|
@@ -971,10 +896,7 @@ describe("Isomorphic Handler", function () {
|
|
|
971
896
|
.expect(200)
|
|
972
897
|
.then((res) => {
|
|
973
898
|
const response = JSON.parse(res.text);
|
|
974
|
-
assert.equal(
|
|
975
|
-
'<div data-page-type="home-page">foobar</div>',
|
|
976
|
-
response.content
|
|
977
|
-
);
|
|
899
|
+
assert.equal('<div data-page-type="home-page">foobar</div>', response.content);
|
|
978
900
|
assert.equal("foobar", response.store.qt.data.text);
|
|
979
901
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
980
902
|
assert.equal("home-page", response.store.qt.pageType);
|
|
@@ -985,8 +907,7 @@ describe("Isomorphic Handler", function () {
|
|
|
985
907
|
const app = express();
|
|
986
908
|
mountQuintypeAt(app, (hostname) => undefined);
|
|
987
909
|
createApp(
|
|
988
|
-
(pageType, params, config, client, { host }) =>
|
|
989
|
-
Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
910
|
+
(pageType, params, config, client, { host }) => Promise.resolve({ pageType, data: { text: "foobar", host } }),
|
|
990
911
|
[{ pageType: "home-page", path: "/", exact: true }],
|
|
991
912
|
{},
|
|
992
913
|
app
|
|
@@ -998,10 +919,7 @@ describe("Isomorphic Handler", function () {
|
|
|
998
919
|
.expect(200)
|
|
999
920
|
.then((res) => {
|
|
1000
921
|
const response = JSON.parse(res.text);
|
|
1001
|
-
assert.equal(
|
|
1002
|
-
'<div data-page-type="home-page">foobar</div>',
|
|
1003
|
-
response.content
|
|
1004
|
-
);
|
|
922
|
+
assert.equal('<div data-page-type="home-page">foobar</div>', response.content);
|
|
1005
923
|
assert.equal("foobar", response.store.qt.data.text);
|
|
1006
924
|
assert.equal("127.0.0.1", response.store.qt.data.host);
|
|
1007
925
|
assert.equal("home-page", response.store.qt.pageType);
|