In aspnet-prerendering, parse the incoming querystring before passing it to the boot func for convenience. Fixes #638.

This commit is contained in:
SteveSandersonMS
2017-02-03 10:52:11 +00:00
parent a9e97f6783
commit 61ffca6290
2 changed files with 4 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "aspnet-prerendering",
"version": "2.0.2",
"version": "2.0.3",
"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",
"scripts": {

View File

@@ -16,7 +16,9 @@ export function createServerRenderer(bootFunc: BootFunc): RenderToStringFunc {
});
const parsedAbsoluteRequestUrl = url.parse(absoluteRequestUrl);
const params: BootFuncParams = {
location: url.parse(requestPathAndQuery),
// It's helpful for boot funcs to receive the query as a key-value object, so parse it here
// e.g., react-redux-router requires location.query to be a key-value object for consistency with client-side behaviour
location: url.parse(requestPathAndQuery, /* parseQueryString */ true),
origin: parsedAbsoluteRequestUrl.protocol + '//' + parsedAbsoluteRequestUrl.host,
url: requestPathAndQuery,
baseUrl: (requestPathBase || '') + '/',