Add ClientIP to RequestMessage / RequestLog (#46)

This commit is contained in:
Stef Heyenrath
2017-09-18 20:01:38 +02:00
parent f776911ef8
commit 139ea77888
22 changed files with 414 additions and 134 deletions

View File

@@ -8,11 +8,13 @@ namespace WireMock.Net.Tests
//[TestFixture]
public class RequestMessageTests
{
private const string clientIP = "::1";
[Fact]
public void Should_handle_empty_query()
{
// given
var request = new RequestMessage(new Uri("http://localhost/foo"), "POST");
var request = new RequestMessage(new Uri("http://localhost/foo"), "POST", clientIP);
// then
Check.That(request.GetParameter("not_there")).IsNull();
@@ -24,7 +26,7 @@ namespace WireMock.Net.Tests
// given
string bodyAsString = "whatever";
byte[] body = Encoding.UTF8.GetBytes(bodyAsString);
var request = new RequestMessage(new Uri("http://localhost?foo=bar&multi=1&multi=2"), "POST", body, bodyAsString, Encoding.UTF8);
var request = new RequestMessage(new Uri("http://localhost?foo=bar&multi=1&multi=2"), "POST", clientIP, body, bodyAsString, Encoding.UTF8);
// then
Check.That(request.GetParameter("foo")).Contains("bar");
@@ -32,4 +34,4 @@ namespace WireMock.Net.Tests
Check.That(request.GetParameter("multi")).Contains("2");
}
}
}
}