/// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public async Task InvokeAsync(HttpContext context)
        {
            if (options.RequestConstrainAsync != null)
            {
                if (!await options.RequestConstrainAsync(context))
                {
                    return;
                }
            }

            var request = context.Request;

            var contents = ExploreHelper.GetContents(options);

            if (options.ReturnAbsolutePath)
            {
                var port       = request.Url.IsDefaultPort ? null : $":{request.Url.Port}";
                var pathPrefix = $"{request.Url.Scheme}://{request.Url.Host}{port}/";
                foreach (var item in contents)
                {
                    fixPath(item, pathPrefix);
                }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <param name="next"></param>
        /// <returns></returns>
        public async Task InvokeAsync(HttpContext context, RequestDelegate next)
        {
            var options = this.options.Value;

            if (options.RequestConstrainAsync != null)
            {
                if (!await options.RequestConstrainAsync(context))
                {
                    return;
                }
            }

            var request = context.Request;

            var contents = ExploreHelper.GetContents(options);

            if (options.ReturnAbsolutePath)
            {
                var pathPrefix = $"{request.Scheme}://{request.Host}/";
                foreach (var item in contents)
                {
                    fixPath(item, pathPrefix);
                }