/// <inheritdoc/>
 public Task <bool> IsValidRequestAsync(HttpContext context) => Task.FromResult(FormatHelpers.GetExtension(this.options.Configuration, context.Request.GetDisplayUrl()) != null);
예제 #2
0
 /// <inheritdoc/>
 public Task <bool> IsValidRequestAsync(HttpContext context, ILogger logger)
 {
     return(Task.FromResult(FormatHelpers.GetExtension(this.options.Configuration, context.Request.Path) != null));
 }
 /// <inheritdoc/>
 public bool IsValidRequest(HttpContext context) => FormatHelpers.GetExtension(this.options.Configuration, context.Request.GetDisplayUrl()) != null;
예제 #4
0
        public void GetExtensionShouldAcknowledgeQueryStringFormatParameter()
        {
            string uri = "http://www.example.org/some/path/to/image.bmp?width=300&format=png";

            Assert.Equal("png", FormatHelpers.GetExtension(Configuration.Default, uri));
        }
예제 #5
0
        public void GetExtensionShouldIgnoreQueryStringWithoutFormatParamter()
        {
            string uri = "http://www.example.org/some/path/to/image.bmp?width=300&foo=.png";

            Assert.Equal("bmp", FormatHelpers.GetExtension(Configuration.Default, uri));
        }
예제 #6
0
        public void GetExtensionShouldNotMatchExtensionWithoutDotPrefix()
        {
            string uri = "http://www.example.org/some/path/to/bmpimage";

            Assert.Null(FormatHelpers.GetExtension(Configuration.Default, uri));
        }
예제 #7
0
        public void GetExtensionShouldMatchDefaultExtensions(string expected, string ext)
        {
            string uri = $"http://www.example.org/some/path/to/image.{ext}?width=300";

            Assert.Equal(expected, FormatHelpers.GetExtension(Configuration.Default, uri));
        }