public XRobotsTagMiddleware(AppFunc next, XRobotsTagOptions options) : base(next) { _config = options.Config; var headerGenerator = new HeaderGenerator(); _headerResult = headerGenerator.CreateXRobotsTagResult(_config); }
/// <summary> /// Adds a middleware to the ASP.NET Core pipeline that sets the X-Robots-Tag header. /// </summary> /// <param name="app">The <see cref="IApplicationBuilder" /> to which the middleware is added.</param> /// <param name="configurer">An <see cref="Action" /> that configures the options for the middleware.</param> /// <returns>The <see cref="IApplicationBuilder" /> supplied in the app parameter.</returns> public static IApplicationBuilder UseXRobotsTag(this IApplicationBuilder app, Action <IFluentXRobotsTagOptions> configurer) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (configurer == null) { throw new ArgumentNullException(nameof(configurer)); } var options = new XRobotsTagOptions(); configurer(options); return(app.UseMiddleware <XRobotsTagMiddleware>(options)); }
public void Setup() { _options = new XRobotsTagOptions(); }
public XRobotsTagOptionsTests() { _options = new XRobotsTagOptions(); }