internal static bool ShouldFallback(this HttpContext context, SpaFallbackOptions options)
        {
            if (context.Response.HasStarted)
            {
                return(false);
            }

            if (context.Response.StatusCode != StatusCodes.Status404NotFound)
            {
                return(false);
            }

            if (!IsGet(context.Request.Method))
            {
                return(false);
            }

            // Fallback only on "hard" 404s, i.e. when the request reached the marker middleware.
            if (!context.Items.ContainsKey(MarkerKey))
            {
                return(false);
            }

            if (HasFileExtension(context.Request.Path))
            {
                return(options.AllowFileExtensions);
            }

            return(true);
        }
 internal static bool ShouldThrow(this HttpContext context, SpaFallbackOptions options)
 {
     return(context.Response.StatusCode == StatusCodes.Status404NotFound && options.ThrowIfFallbackFails);
 }