Created
June 6, 2017 09:23
-
-
Save cdm/711708411aa56de9ad780c0f9e31f137 to your computer and use it in GitHub Desktop.
Echo request/response in HttpMessageHandler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if DEBUG | |
Debug.WriteLine("Request:"); | |
Debug.WriteLine(request.ToString()); | |
if (request.Content != null) | |
{ | |
var bytes = await request.Content.ReadAsByteArrayAsync(); | |
Debug.WriteLine(bytes.Length); | |
Debug.WriteLine(Encoding.UTF8.GetString(bytes, 0, bytes.Length)); | |
Debug.WriteLine(await request.Content.ReadAsStringAsync()); | |
} | |
Debug.WriteLine(""); | |
#endif | |
// Send the request, with auth headers if available | |
var r = await base.SendAsync(request, cancellationToken).ConfigureAwait(false); | |
#if DEBUG | |
Debug.WriteLine("Response:"); | |
Debug.WriteLine(r.ToString()); | |
if (r.Content != null) | |
{ | |
Debug.WriteLine(await r.Content.ReadAsStringAsync()); | |
} | |
Debug.WriteLine(""); | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment