frosty 0.0.83 → 0.0.85
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
|
@@ -27,6 +27,10 @@ import _ from 'lodash';
|
|
|
27
27
|
import { ServerDOMRenderer } from 'frosty/server-dom';
|
|
28
28
|
import { JSDOM, CookieJar, ResourceLoader } from 'jsdom';
|
|
29
29
|
|
|
30
|
+
class NoOpResourceLoader extends ResourceLoader {
|
|
31
|
+
fetch(url, options) { return null; }
|
|
32
|
+
}
|
|
33
|
+
|
|
30
34
|
export const renderToHTML = async (App, {
|
|
31
35
|
request: req,
|
|
32
36
|
response: res,
|
|
@@ -40,7 +44,7 @@ export const renderToHTML = async (App, {
|
|
|
40
44
|
for (const cookie of _.split(req.get('cookie'), ';')) {
|
|
41
45
|
cookieJar.setCookieSync(cookie, url);
|
|
42
46
|
}
|
|
43
|
-
const loader = new
|
|
47
|
+
const loader = new NoOpResourceLoader({ userAgent });
|
|
44
48
|
const dom = new JSDOM(undefined, { url, referrer, userAgent, resources: loader, cookieJar });
|
|
45
49
|
const renderer = new ServerDOMRenderer(dom);
|
|
46
50
|
res.setHeader('Content-Type', 'text/html');
|