Merge pull request #366 from dotnet-maestro-bot/merge/release/2.2-to-master

[automated] Merge branch 'release/2.2' => 'master'
This commit is contained in:
Chris Ross 2018-09-20 13:13:22 -07:00 committed by GitHub
commit db7c2bf70c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -155,6 +155,11 @@ namespace Microsoft.AspNetCore.ResponseCompression
return false;
}
if (context.Response.Headers.ContainsKey(HeaderNames.ContentEncoding))
{
return false;
}
var mimeType = context.Response.ContentType;
if (string.IsNullOrEmpty(mimeType))

View File

@ -321,8 +321,9 @@ namespace Microsoft.AspNetCore.ResponseCompression.Tests
CheckResponseNotCompressed(response, expectedBodyLength: 50, sendVaryHeader: false);
}
[Fact]
public async Task Response_WithContentEncodingAlreadySet_Stacked()
public async Task Response_WithContentEncodingAlreadySet_NotReCompressed()
{
var otherContentEncoding = "something";
@ -332,8 +333,8 @@ namespace Microsoft.AspNetCore.ResponseCompression.Tests
});
Assert.True(response.Content.Headers.ContentEncoding.Contains(otherContentEncoding));
Assert.True(response.Content.Headers.ContentEncoding.Contains("gzip"));
Assert.Equal(24, response.Content.Headers.ContentLength);
Assert.False(response.Content.Headers.ContentEncoding.Contains("gzip"));
Assert.Equal(50, response.Content.Headers.ContentLength);
}
[Theory]