Update aspnet-prerendering to 3.0.1, fixing the default "fetch" base URL to match the real application root URL

This commit is contained in:
Steve Sanderson
2017-07-11 22:37:09 +01:00
parent 8acba88160
commit 56c806b34e
2 changed files with 4 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "aspnet-prerendering", "name": "aspnet-prerendering",
"version": "2.0.6", "version": "3.0.1",
"description": "Helpers for server-side rendering of JavaScript applications in ASP.NET Core projects. Works in conjunction with the Microsoft.AspNetCore.SpaServices NuGet package.", "description": "Helpers for server-side rendering of JavaScript applications in ASP.NET Core projects. Works in conjunction with the Microsoft.AspNetCore.SpaServices NuGet package.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@@ -17,7 +17,7 @@
"url": "https://github.com/aspnet/JavaScriptServices.git" "url": "https://github.com/aspnet/JavaScriptServices.git"
}, },
"dependencies": { "dependencies": {
"domain-task": "^2.0.2" "domain-task": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^6.0.42", "@types/node": "^6.0.42",

View File

@@ -26,6 +26,7 @@ export function createServerRenderer(bootFunc: BootFunc): RenderToStringFunc {
domainTasks: domainTaskCompletionPromise, domainTasks: domainTaskCompletionPromise,
data: customDataParameter data: customDataParameter
}; };
const absoluteBaseUrl = params.origin + params.baseUrl; // Should be same value as page's <base href>
// Open a new domain that can track all the async tasks involved in the app's execution // Open a new domain that can track all the async tasks involved in the app's execution
domainTaskRun(/* code to run */ () => { domainTaskRun(/* code to run */ () => {
@@ -35,7 +36,7 @@ export function createServerRenderer(bootFunc: BootFunc): RenderToStringFunc {
bindPromiseContinuationsToDomain(domainTaskCompletionPromise, domain['active']); bindPromiseContinuationsToDomain(domainTaskCompletionPromise, domain['active']);
// Make the base URL available to the 'domain-tasks/fetch' helper within this execution context // Make the base URL available to the 'domain-tasks/fetch' helper within this execution context
domainTaskBaseUrl(absoluteRequestUrl); domainTaskBaseUrl(absoluteBaseUrl);
// Begin rendering, and apply a timeout // Begin rendering, and apply a timeout
const bootFuncPromise = bootFunc(params); const bootFuncPromise = bootFunc(params);