public ReportToMiddleware(ReportToOptions options) { Groups = options.Groups; _headerValue = Groups.Count switch { 0 => throw new ArgumentException("At least one group must be included for the Report-To header.", nameof(options)), 1 => Groups.Single().ToString(), _ => String.Join(',', Groups) }; }
public static IServiceCollection AddReportTo(this IServiceCollection services, ReportToOptions options) { services.AddSingleton <ReportToMiddleware>(); services.AddSingleton(options); return(services); }