mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Add status code support to SpaPrerenderingExtensions
This commit is contained in:
@@ -225,7 +225,8 @@ namespace Microsoft.AspNetCore.Builder
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(renderResult.RedirectUrl))
|
if (!string.IsNullOrEmpty(renderResult.RedirectUrl))
|
||||||
{
|
{
|
||||||
context.Response.Redirect(renderResult.RedirectUrl);
|
var permanentRedirect = renderResult.StatusCode.GetValueOrDefault() == 301;
|
||||||
|
context.Response.Redirect(renderResult.RedirectUrl, permanentRedirect);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -239,6 +240,11 @@ namespace Microsoft.AspNetCore.Builder
|
|||||||
$"embed any information you wish to return to the client.");
|
$"embed any information you wish to return to the client.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (renderResult.StatusCode.HasValue)
|
||||||
|
{
|
||||||
|
context.Response.StatusCode = renderResult.StatusCode.Value;
|
||||||
|
}
|
||||||
|
|
||||||
context.Response.ContentType = "text/html";
|
context.Response.ContentType = "text/html";
|
||||||
await context.Response.WriteAsync(renderResult.Html);
|
await context.Response.WriteAsync(renderResult.Html);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user