mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-31 14:43:40 +02:00
Add support for GZip and Deflate (#439)
* gzip - wip * wip * tests * fix gzip and deflate * CheckIfShouldKillVBCSCompiler * DisableRequestBodyDecompressing
This commit is contained in:
@@ -243,18 +243,36 @@ namespace WireMock.Net.Tests.RequestMatchers
|
||||
// assign
|
||||
BodyData bodyData;
|
||||
if (body is byte[] b)
|
||||
bodyData = await BodyParser.Parse(new MemoryStream(b), null, true);
|
||||
{
|
||||
var bodyParserSettings = new BodyParserSettings
|
||||
{
|
||||
Stream = new MemoryStream(b),
|
||||
ContentType = null,
|
||||
DeserializeJson = true
|
||||
};
|
||||
bodyData = await BodyParser.Parse(bodyParserSettings);
|
||||
}
|
||||
else if (body is string s)
|
||||
bodyData = await BodyParser.Parse(new MemoryStream(Encoding.UTF8.GetBytes(s)), null, true);
|
||||
{
|
||||
var bodyParserSettings = new BodyParserSettings
|
||||
{
|
||||
Stream = new MemoryStream(Encoding.UTF8.GetBytes(s)),
|
||||
ContentType = null,
|
||||
DeserializeJson = true
|
||||
};
|
||||
bodyData = await BodyParser.Parse(bodyParserSettings);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
var requestMessage = new RequestMessage(new UrlDetails("http://localhost"), "GET", "127.0.0.1", bodyData);
|
||||
|
||||
// act
|
||||
var result = new RequestMatchResult();
|
||||
var score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
|
||||
// assert
|
||||
Check.That(score).IsEqualTo(shouldMatch ? 1d : 0d);
|
||||
}
|
||||
@@ -265,7 +283,7 @@ namespace WireMock.Net.Tests.RequestMatchers
|
||||
{
|
||||
var json = "{'a':'b'}";
|
||||
var str = "HelloWorld";
|
||||
var bytes = new byte[] {0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00};
|
||||
var bytes = new byte[] { 0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00 };
|
||||
|
||||
return new TheoryData<object, RequestMessageBodyMatcher, bool>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user