@ekino/rendr-loader
Advanced tools
Comparing version
@@ -134,4 +134,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
if (ctx.isClientSide) { | ||
page = rendr_core_2.createPage(response.data); | ||
return [2, next(page)]; | ||
if (response.headers["x-rendr-content-type"] !== "rendr/document") { | ||
next(); | ||
} | ||
if (response.headers["content-type"].substr(0, 16) === "application/json") { | ||
return [2, next(rendr_core_2.createPage(response.data))]; | ||
} | ||
return [2, next()]; | ||
} | ||
@@ -138,0 +143,0 @@ if (ctx.isServerSide) { |
@@ -78,4 +78,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
if (ctx.isClientSide) { | ||
page = createPage(response.data); | ||
return [2, next(page)]; | ||
if (response.headers["x-rendr-content-type"] !== "rendr/document") { | ||
next(); | ||
} | ||
if (response.headers["content-type"].substr(0, 16) === "application/json") { | ||
return [2, next(createPage(response.data))]; | ||
} | ||
return [2, next()]; | ||
} | ||
@@ -82,0 +87,0 @@ if (ctx.isServerSide) { |
@@ -83,4 +83,9 @@ "use strict"; | ||
if (ctx.isClientSide) { | ||
page = rendr_core_1.createPage(response.data); | ||
return [2, next(page)]; | ||
if (response.headers["x-rendr-content-type"] !== "rendr/document") { | ||
next(); | ||
} | ||
if (response.headers["content-type"].substr(0, 16) === "application/json") { | ||
return [2, next(rendr_core_1.createPage(response.data))]; | ||
} | ||
return [2, next()]; | ||
} | ||
@@ -87,0 +92,0 @@ if (ctx.isServerSide) { |
{ | ||
"name": "@ekino/rendr-loader", | ||
"license": "MIT", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"main": "dist/lib/index.js", | ||
@@ -13,3 +13,3 @@ "typing": "dist/lib/index.d.ts", | ||
"dependencies": { | ||
"@ekino/rendr-core": "0.0.13", | ||
"@ekino/rendr-core": "0.0.14", | ||
"axios": "^0.19.0", | ||
@@ -26,3 +26,3 @@ "path-match": "^1.2.4", | ||
}, | ||
"gitHead": "e9fcc0a6671174e9a2c54ac38bf3f8833143d568" | ||
"gitHead": "fe3d847f373979f93acd4eaf800110310f68aeab" | ||
} |
@@ -55,4 +55,16 @@ import { createPage, Page } from "@ekino/rendr-core"; | ||
if (ctx.isClientSide) { | ||
page = createPage(response.data); | ||
return next(page); | ||
if (response.headers["x-rendr-content-type"] !== "rendr/document") { | ||
next(); | ||
} | ||
// express can send this content type: application/json; charset=utf-8 | ||
if ( | ||
response.headers["content-type"].substr(0, 16) === "application/json" | ||
) { | ||
return next(createPage(response.data)); | ||
} | ||
// not a JSON, probably a stream ! | ||
// => don't know how to deal with this use case... | ||
return next(); | ||
} | ||
@@ -59,0 +71,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
77011
2.46%1437
1.77%+ Added
- Removed
Updated