/// <inheritdoc/> public Task <bool> IsValidRequestAsync(HttpContext context) => Task.FromResult(FormatHelpers.GetExtension(this.options.Configuration, context.Request.GetDisplayUrl()) != null);
/// <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;
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)); }
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)); }
public void GetExtensionShouldNotMatchExtensionWithoutDotPrefix() { string uri = "http://www.example.org/some/path/to/bmpimage"; Assert.Null(FormatHelpers.GetExtension(Configuration.Default, uri)); }
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)); }