mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +00:00
Add status code response capabilities to PrerenderTagHelper and RenderToStringResult. Client can now send status codes back based on client routes.
This commit is contained in:
committed by
Steve Sanderson
parent
b9c387bf5f
commit
347524a116
@@ -129,6 +129,11 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (result.StatusCode.HasValue)
|
||||||
|
{
|
||||||
|
ViewContext.HttpContext.Response.StatusCode = result.StatusCode.Value;
|
||||||
|
}
|
||||||
|
|
||||||
// It's some HTML to inject
|
// It's some HTML to inject
|
||||||
output.Content.SetHtmlContent(result.Html);
|
output.Content.SetHtmlContent(result.Html);
|
||||||
|
|
||||||
|
|||||||
@@ -25,5 +25,10 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
|
|||||||
/// to the SPA's routing configuration.
|
/// to the SPA's routing configuration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RedirectUrl { get; set; }
|
public string RedirectUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If set, specifies the HTTP status code that should be sent back with the server response.
|
||||||
|
/// </summary>
|
||||||
|
public int? StatusCode { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,7 @@ interface RenderToStringCallback {
|
|||||||
|
|
||||||
interface RenderToStringResult {
|
interface RenderToStringResult {
|
||||||
html: string;
|
html: string;
|
||||||
|
statusCode: number;
|
||||||
globals?: { [key: string]: any };
|
globals?: { [key: string]: any };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user