mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-10 03:13:53 +02:00
Fix issues with Proxy mode and Binary Request Bodies (#334)
* Add Test for Proxy with binary request * Fix binary parsing in BodyParser * Fix binary Matching in RequestMessageBodyMatcher * Improved Binary Matching in RequestMessageBodyMatcher * BodyParser: Add test for Content Autodetection * RequestMessageBodyMatcherTests: Make Code more pretty :) * BodyParserChanges: Revert white space changes * Fixed test for different behavior in request matching
This commit is contained in:
@@ -50,6 +50,22 @@ namespace WireMock.Net.Tests.Util
|
||||
Check.That(body.DetectedBodyTypeFromContentType).IsEqualTo(detectedBodyTypeFromContentType);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(new byte[] {34, 97, 34}, BodyType.Json)]
|
||||
[InlineData(new byte[] {97}, BodyType.String)]
|
||||
[InlineData(new byte[] {0xFF, 0xD8, 0xFF, 0xE0}, BodyType.Bytes)]
|
||||
public async Task BodyParser_Parse_DetectedBodyType(byte[] content, BodyType detectedBodyType)
|
||||
{
|
||||
// arrange
|
||||
var memoryStream = new MemoryStream(content);
|
||||
|
||||
// act
|
||||
var body = await BodyParser.Parse(memoryStream, null);
|
||||
|
||||
// assert
|
||||
Check.That(body.DetectedBodyType).IsEqualTo(detectedBodyType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task BodyParser_Parse_WithUTF8EncodingAndContentTypeMultipart_DetectedBodyTypeEqualsString()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user