diff --git a/src/Elmah.Io/DictionaryExtensions.cs b/src/Elmah.Io/DictionaryExtensions.cs index c9feeb3..f342787 100644 --- a/src/Elmah.Io/DictionaryExtensions.cs +++ b/src/Elmah.Io/DictionaryExtensions.cs @@ -89,18 +89,5 @@ internal static string ApplicationName(this IDictionary dictionary) const string applicationname = "applicationName"; return dictionary.ContainsCaseInsensitive(applicationname) ? dictionary.ValueByKeyCaseInsensitive(applicationname) : string.Empty; } - - internal static string ProxyHost(this IDictionary dictionary) - { - const string proxyHost = "proxyHost"; - return dictionary.ContainsCaseInsensitive(proxyHost) ? dictionary.ValueByKeyCaseInsensitive(proxyHost) : string.Empty; - } - - internal static int? ProxyPort(this IDictionary dictionary) - { - const string proxyPort = "proxyPort"; - var value = dictionary.ContainsCaseInsensitive(proxyPort) ? dictionary.ValueByKeyCaseInsensitive(proxyPort) : null; - return !string.IsNullOrWhiteSpace(value) && int.TryParse(value, out var port) ? port : null; - } } } \ No newline at end of file diff --git a/src/Elmah.Io/ErrorLog.cs b/src/Elmah.Io/ErrorLog.cs index e16548e..e9b0cc6 100644 --- a/src/Elmah.Io/ErrorLog.cs +++ b/src/Elmah.Io/ErrorLog.cs @@ -69,20 +69,12 @@ public ErrorLog(IDictionary config) if (Api != null) return; - var options = new ElmahIoOptions + var elmahioApi = ElmahioAPI.Create(apiKey, new ElmahIoOptions { Timeout = new TimeSpan(0, 0, 5), UserAgent = UserAgent(), - }; - - var proxyHost = config.ProxyHost(); - var proxyPort = config.ProxyPort(); - if (proxyHost != null && proxyPort != null) - { - options.WebProxy = new WebProxy(proxyHost, (int)proxyPort); - } - - var elmahioApi = ElmahioAPI.Create(apiKey, options); + WebProxy = WebRequest.DefaultWebProxy, + }); Api = elmahioApi; } diff --git a/test/Elmah.Io.Tests/DictionaryExtensionsTest.cs b/test/Elmah.Io.Tests/DictionaryExtensionsTest.cs index e3fc70a..630315d 100644 --- a/test/Elmah.Io.Tests/DictionaryExtensionsTest.cs +++ b/test/Elmah.Io.Tests/DictionaryExtensionsTest.cs @@ -22,37 +22,6 @@ public void CanGetApplicationName(string expectedValue, string key, string value Assert.That(dictionary.ApplicationName(), Is.EqualTo(expectedValue)); } - [TestCase(null, "proxyHost", null)] - [TestCase("", "proxyHost", "")] - [TestCase("value", "proxyHost", "value")] - [TestCase("value", "proxyHost", "value")] - [TestCase("", null, null)] - public void CanGetProxyHost(string expectedValue, string key, string value) - { - var dictionary = new Hashtable(); - if (!string.IsNullOrWhiteSpace(key)) - { - dictionary.Add(key, value); - } - - Assert.That(dictionary.ProxyHost(), Is.EqualTo(expectedValue)); - } - - [TestCase(null, "proxyPort", null)] - [TestCase(null, "proxyPort", "")] - [TestCase(5555, "proxyPort", "5555")] - [TestCase(6666, "proxyPort", "6666")] - public void CanGetProxyPort(int? expectedValue, string key, string value) - { - var dictionary = new Hashtable(); - if (!string.IsNullOrWhiteSpace(key)) - { - dictionary.Add(key, value); - } - - Assert.That(dictionary.ProxyPort(), Is.EqualTo(expectedValue)); - } - [TestCase(false, "DC14639C-B930-4960-9A3A-BD73C6CA6375", "logId", "DC14639C-B930-4960-9A3A-BD73C6CA6375")] [TestCase(false, "E70628F4-EEED-4C06-B570-663F8AFA80E5", "LogId", "E70628F4-EEED-4C06-B570-663F8AFA80E5")] [TestCase(true, null, "logId", "No guid")]