/// <summary> /// Add the ResponseHeaders middleware to include the configured response headers with each response. /// </summary> /// <param name="app"></param> public static IApplicationBuilder UseResponseHeaders(this IApplicationBuilder app, Action <ResponseHeaderBuilder> options) { var builder = new ResponseHeaderBuilder(); options?.Invoke(builder); var policy = builder.Build(); return(app.UseMiddleware <ResponseHeadersMiddleware>(policy)); }
/// <summary> /// Configure the response headers middleware and add it to the services collection. /// </summary> /// <param name="services"></param> /// <param name="options"></param> /// <returns></returns> public static IServiceCollection AddResponseHeaders(this IServiceCollection services, Action <ResponseHeaderBuilder> options) { var builder = new ResponseHeaderBuilder(); options?.Invoke(builder); var policy = builder.Build(); return(services.AddSingleton(policy)); }
/// <summary> /// Add the ResponseHeaders middleware to include the configured response headers with each response. /// </summary> /// <param name="app"></param> public static IApplicationBuilder UseResponseHeaders(this IApplicationBuilder app, ResponseHeaderBuilder builder) { var policy = builder.Build(); return(app.UseMiddleware <ResponseHeadersMiddleware>(policy)); }