[ResponseCompression] Compare MimeTypes as case insensitive

This commit is contained in:
Chris R 2016-09-26 15:35:30 -07:00
parent 665f2f8773
commit 89a6f453ce
2 changed files with 2 additions and 2 deletions

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.ResponseCompression
throw new ArgumentNullException(nameof(mimeTypes)); throw new ArgumentNullException(nameof(mimeTypes));
} }
var mimeTypeSet = new HashSet<string>(mimeTypes); var mimeTypeSet = new HashSet<string>(mimeTypes, StringComparer.OrdinalIgnoreCase);
return (httpContext) => return (httpContext) =>
{ {

View File

@ -36,6 +36,7 @@ namespace Microsoft.AspNetCore.ResponseCompression.Tests
[Theory] [Theory]
[InlineData("text/plain")] [InlineData("text/plain")]
[InlineData("text/PLAIN")]
[InlineData("text/plain; charset=ISO-8859-4")] [InlineData("text/plain; charset=ISO-8859-4")]
[InlineData("text/plain ; charset=ISO-8859-4")] [InlineData("text/plain ; charset=ISO-8859-4")]
public void CreateShouldCompressResponseDelegate_WithCharset_Compress(string contentType) public void CreateShouldCompressResponseDelegate_WithCharset_Compress(string contentType)
@ -53,7 +54,6 @@ namespace Microsoft.AspNetCore.ResponseCompression.Tests
[Theory] [Theory]
[InlineData("")] [InlineData("")]
[InlineData("text/plain2")] [InlineData("text/plain2")]
[InlineData("text/PLAIN")]
public void CreateShouldCompressResponseDelegate_OtherContentTypes_NoMatch(string contentType) public void CreateShouldCompressResponseDelegate_OtherContentTypes_NoMatch(string contentType)
{ {
var httpContext = new DefaultHttpContext(); var httpContext = new DefaultHttpContext();