Example #1
0
        private void OnRequestEnd(WebRequest request, WebResponse response)
        {
            if (response == null)
            {
                this.log.Fatal(f => f("No response received!"));
                return;
            }

            string responseBody;

            using (var responseStream = response.GetResponseStream())
            {
                if (responseStream == null)
                {
                    return;
                }

                using (var sr = new StreamReader(responseStream))
                {
                    responseBody = sr.ReadToEnd();
                    this.log.Debug(f => f("Received from Airbrake.\n{0}", responseBody));
                }
            }

            if (RequestEnd != null)
            {
                RequestEndEventArgs e = new RequestEndEventArgs(request, response, responseBody);
                RequestEnd(this, e);
            }
        }
        private void OnRequestEnd(WebRequest request, WebResponse response)
        {
            if (response == null)
            {
                //this.log.Fatal(f => f("No response received!"));
                return;
            }

            string responseBody;

            using (var responseStream = response.GetResponseStream())
            {
                if (responseStream == null)
                    return;

                using (var sr = new StreamReader(responseStream))
                {
                    responseBody = sr.ReadToEnd();
                    //this.log.Debug(f => f("Received from Airbrake.\n{0}", responseBody));
                }
            }

            if (RequestEnd != null)
            {
                RequestEndEventArgs e = new RequestEndEventArgs(request, response, responseBody);
                RequestEnd(this, e);
            }
        }