Exemple #1
0
        public ProxyMiddleware(RequestDelegate next, ILogger <ProxyMiddleware> logger, ProxyOptions options)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _next = next;
            Log   = logger;

            options.EnsureValid();
            _cacheDirectory = options.CacheDirectory;
            _apiBaseAddress = options.ApiBaseAddress;
        }
Exemple #2
0
 public static IServiceCollection AddProxy(this IServiceCollection services, ProxyOptions options)
 {
     return(services.AddSingleton <ProxyOptions>(options));
 }