mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2026-02-08 00:54:31 +00:00
Further stylistic tweaks
This commit is contained in:
@@ -4,7 +4,7 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
|
||||
{
|
||||
public JavaScriptModuleExport(string moduleName)
|
||||
{
|
||||
this.ModuleName = moduleName;
|
||||
ModuleName = moduleName;
|
||||
}
|
||||
|
||||
public string ModuleName { get; private set; }
|
||||
|
||||
@@ -17,18 +17,20 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
|
||||
});
|
||||
}
|
||||
|
||||
public static async Task<RenderToStringResult> RenderToString(
|
||||
public static Task<RenderToStringResult> RenderToString(
|
||||
string applicationBasePath,
|
||||
INodeServices nodeServices,
|
||||
JavaScriptModuleExport bootModule,
|
||||
string requestAbsoluteUrl,
|
||||
string requestPathAndQuery)
|
||||
=> await nodeServices.InvokeExport<RenderToStringResult>(
|
||||
{
|
||||
return nodeServices.InvokeExport<RenderToStringResult>(
|
||||
NodeScript.Value.FileName,
|
||||
"renderToString",
|
||||
applicationBasePath,
|
||||
bootModule,
|
||||
requestAbsoluteUrl,
|
||||
requestPathAndQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,9 +24,14 @@ namespace Microsoft.AspNetCore.SpaServices
|
||||
string routeKey,
|
||||
RouteValueDictionary values,
|
||||
RouteDirection routeDirection)
|
||||
=> !HasDotInLastSegment(values[_clientRouteTokenName] as string ?? string.Empty);
|
||||
{
|
||||
return !HasDotInLastSegment(values[_clientRouteTokenName] as string ?? string.Empty);
|
||||
}
|
||||
|
||||
private bool HasDotInLastSegment(string uri)
|
||||
=> uri.IndexOf('.', uri.LastIndexOf('/') + 1) >= 0;
|
||||
{
|
||||
var lastSegmentStartPos = uri.LastIndexOf('/');
|
||||
return uri.IndexOf('.', lastSegmentStartPos + 1) >= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,13 +17,15 @@ namespace Microsoft.AspNetCore.Builder
|
||||
object defaults,
|
||||
object constraints = null,
|
||||
object dataTokens = null)
|
||||
=> MapSpaFallbackRoute(
|
||||
{
|
||||
MapSpaFallbackRoute(
|
||||
routeBuilder,
|
||||
name,
|
||||
/* templatePrefix */ null,
|
||||
defaults,
|
||||
constraints,
|
||||
dataTokens);
|
||||
}
|
||||
|
||||
public static void MapSpaFallbackRoute(
|
||||
this IRouteBuilder routeBuilder,
|
||||
@@ -34,7 +36,6 @@ namespace Microsoft.AspNetCore.Builder
|
||||
object dataTokens = null)
|
||||
{
|
||||
var template = CreateRouteTemplate(templatePrefix);
|
||||
|
||||
var constraintsDict = ObjectToDictionary(constraints);
|
||||
constraintsDict.Add(ClientRouteTokenName, new SpaRouteConstraint(ClientRouteTokenName));
|
||||
|
||||
|
||||
@@ -67,10 +67,10 @@ namespace Microsoft.AspNetCore.SpaServices.Webpack
|
||||
requestMessage.Method = new HttpMethod(context.Request.Method);
|
||||
|
||||
using (
|
||||
var responseMessage =
|
||||
await
|
||||
_httpClient.SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead,
|
||||
context.RequestAborted))
|
||||
var responseMessage = await _httpClient.SendAsync(
|
||||
requestMessage,
|
||||
HttpCompletionOption.ResponseHeadersRead,
|
||||
context.RequestAborted))
|
||||
{
|
||||
if (responseMessage.StatusCode == HttpStatusCode.NotFound)
|
||||
{
|
||||
|
||||
@@ -91,4 +91,4 @@ namespace Microsoft.AspNetCore.Builder
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS0649
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user