using FastGithub.ReverseProxy;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace FastGithub
{
    /// 
    /// https反向代理的中间件扩展
    /// 
    public static class ReverseProxyApplicationBuilderExtensions
    {
        /// 
        /// 使用请求日志中间件
        /// 
        ///  
        /// 
        public static IApplicationBuilder UseRequestLogging(this IApplicationBuilder app)
        {
            var middlware = app.ApplicationServices.GetRequiredService();
            return app.Use(next => context => middlware.InvokeAsync(context, next));
        }
        /// 
        /// 使用https反向代理中间件
        /// 
        /// 
        /// 
        /// 
        public static IApplicationBuilder UseHttpsReverseProxy(this IApplicationBuilder app, string fallbackFile)
        {
            var middleware = app.ApplicationServices.GetRequiredService();
            return app.Use(next => context => middleware.InvokeAsync(context, fallbackFile));
        }
    }
}