Exemplo n.º 1
0
        public XRobotsTagMiddleware(AppFunc next, XRobotsTagOptions options)
            : base(next)
        {
            _config = options.Config;

            var headerGenerator = new HeaderGenerator();
            _headerResult = headerGenerator.CreateXRobotsTagResult(_config);
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 4
0
 public void Setup()
 {
     _options = new XRobotsTagOptions();
 }
Exemplo n.º 5
0
 public XRobotsTagOptionsTests()
 {
     _options = new XRobotsTagOptions();
 }
Exemplo n.º 6
0
 public void Setup()
 {
     _options = new XRobotsTagOptions();
 }