예제 #1
0
 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)
     };
 }
예제 #2
0
 public static IServiceCollection AddReportTo(this IServiceCollection services, ReportToOptions options)
 {
     services.AddSingleton <ReportToMiddleware>();
     services.AddSingleton(options);
     return(services);
 }