public void Post(Uri uri, logEvent item) { try { var httpWebRequest = RequestFor(uri); using (var streamWriter = GetRequestStream(httpWebRequest)) { streamWriter.Write(item.ToJson()); streamWriter.Flush(); var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); httpResponse.Close(); if (httpResponse.StatusCode != HttpStatusCode.Created) { throw new WebException( "Failed to post {0} to {1}.".With(item.GetType().Name, uri)); } } } catch (Exception ex) { //TODO this is a hotfix } }
public void Post(Uri uri, logEvent item) { var httpWebRequest = RequestFor(uri); using (var streamWriter = GetRequestStream(httpWebRequest)) { streamWriter.Write(item.ToJson(resolver)); streamWriter.Flush(); using (var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse()) { if (httpResponse.StatusCode != HttpStatusCode.Created) { throw new WebException("Failed to post {0} to {1}.".With(item.GetType().Name, uri)); } } } }