public virtual void AfterReceiveReply(ref Message reply, object correlationState)
        {
            HttpResponseMessageProperty prop = (HttpResponseMessageProperty)reply.Properties[HttpResponseMessageProperty.Name];
            string body = General.ReadMessageBody(ref reply);

            logger(General.GetHttpResponseLog(prop.StatusCode.ToString(), prop.Headers, body));
        }
 private static void LogResponse(
     string statusCode,
     HttpResponseHeaders headers,
     string content,
     Action <string> logger)
 {
     if (logger != null)
     {
         logger(General.GetHttpResponseLog(statusCode, headers, content));
     }
 }
        protected override HttpResponseMessage ProcessResponse(HttpResponseMessage response, CancellationToken cancellationToken)
        {
            string body = String.Empty;

            if (response.Content != null)
            {
                var contentHeaders = response.Content.Headers;
                var stream         = new MemoryStream();
                response.Content.CopyToAsync(stream).Wait();
                if (stream.Length > 0 && response.Content.Headers.ContentType.MediaType != "application/x-rdp")
                {
                    stream.Position = 0;
                    body            = XElement.Load(stream).ToString();
                }
                stream.Position  = 0;
                response.Content = new StreamContent(stream);
                contentHeaders.ForEach(kv => response.Content.Headers.Add(kv.Key, kv.Value));
            }
            logger(General.GetHttpResponseLog(response.StatusCode.ToString(), response.Headers, body));

            return(response);
        }