public override void Process(HttpMessage message) { // Some tests will check if the Request Content is being read (to // verify their Progress handling) so we'll just copy it to a // MemoryStream if (message.Request.Content != null && message.Request.Content.TryComputeLength(out long length)) { // Set a Content-Length header if TryComputeLength succeeds. message.Request.Headers.SetValue("Content-Length", length.ToString()); if (length > 0) { using (MemoryStream stream = new MemoryStream((int)length)) { message.Request.Content.WriteTo(stream, message.CancellationToken); } } } var requestEntry = RecordTransport.CreateEntry(message.Request, null); if (_skipRequestBodyFilter(requestEntry)) { requestEntry.Request.Body = null; } message.Response = GetResponse(_session.Lookup(requestEntry, _matcher, _sanitizer)); // Copy the ClientRequestId like the HTTP transport. message.Response.ClientRequestId = message.Request.ClientRequestId; }
public override void Process(HttpMessage message) { // Some tests will check if the Request Content is being read (to // verify their Progress handling) so we'll just copy it to a // MemoryStream if (message.Request.Content != null && message.Request.Content.TryComputeLength(out long length) && length > 0) { using (MemoryStream stream = new MemoryStream((int)length)) { message.Request.Content.WriteTo(stream, message.CancellationToken); } } message.Response = GetResponse(_session.Lookup(message.Request, _matcher, _sanitizer)); }