When sending an auto batched request (collection of DTO’s) to a service with RequestLogsFeature enabled, it appears that only the first DTO in the collection is logged as the entry’s RequestDto. Should RequestDto instead include the entire collection?
Here’s a (failing) test adapted from RequestLogsFeatureTests.Does_log_Service_request:
[Test]
public void Does_log_autobatch_request()
{
var client = new JsonServiceClient(Config.ListeningOn)
{
RequestFilter = req => req.Referer = Config.ListeningOn
};
var request = new[]
{
new RequestLogsTest { Name = "foo1" },
new RequestLogsTest { Name = "bar1" }
};
var response = client.SendAll(request);
var json = Config.ListeningOn.CombineWith("requestlogs").GetJsonFromUrl();
var requestLogs = json.FromJson<RequestLogsResponse>();
var requestLog = requestLogs.Results.First();
Assert.That(typeof(IEnumerable<RequestLogsTest>).IsAssignableFrom(request.GetType()));
Assert.That(typeof(IEnumerable<RequestLogsTest>).IsAssignableFrom(requestLog.RequestDto.GetType()));
var requests = (IEnumerable<RequestLogsTest>)requestLog.RequestDto;
Assert.That(requests.First().Name, Is.EqualTo("foo1"));
Assert.That(requests.Last().Name, Is.EqualTo("bar1"));
Assert.That(requestLog.Referer, Is.EqualTo(Config.ListeningOn));
}
Thanks! -Eric