Example #1
0
        private void OnAfterResponseFhirServer(object sender, AfterResponseEventArgs e)
        {
            if (e.Body != null)
            {
                var responseBody = Encoding.UTF8.GetString(e.Body, 0, e.Body.Length);

                //Prettify !!!
                responseBody = JToken.Parse(responseBody).ToString();

                _logger.LogInformation($"Received response with s {e.RawResponse.StatusCode}");
                _logger.LogInformation($"Received response with body: {responseBody }");
            }
        }
Example #2
0
        private void SimpleClient_OnAfterResponse(object sender, AfterResponseEventArgs e)
        {
            Console.Out.WriteLine("##Response");
            Console.Out.WriteLine("Headers:");
            Console.Out.WriteLine("```");
            foreach (var h in e.RawResponse.Headers.AllKeys)
            {
                Console.WriteLine("{0}: {1}", h, e.RawResponse.Headers.Get(h));
            }
            Console.Out.WriteLine("```");
            Console.Out.WriteLine("Body:");
            Console.Out.WriteLine("```json");
            Console.Out.WriteLine(System.Text.Encoding.UTF8.GetString(e.Body ?? new byte[0]));

            Console.Out.WriteLine("```");
        }
 private void Client_OnAfterResponse(object sender, AfterResponseEventArgs e)
 {
     // Test that the response was compressed
     Assert.AreEqual("gzip", e.RawResponse.Headers[HttpResponseHeader.ContentEncoding]);
 }