Skip to content

Commit

Permalink
Version Bump v9.1.1: #358: SendGridClient.SendEmailAsync now throws o…
Browse files Browse the repository at this point in the history
…riginal exception
  • Loading branch information
thinkingserious committed Apr 13, 2017
1 parent 63f8339 commit aa6c700
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 26 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log
All notable changes to this project will be documented in this file.

## [9.1.1] - 2017-04-12
## Fix
- PR #358: SendGridClient.SendEmailAsync now throws original exception
- Thanks to [Otto Dandenell](https://github.com/ottomatic) for the PR!

## [9.1.0] - 2017-03-20
## Update
- PR #405: Reuse HTTP Client
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ var client = new SendGridClient(proxy, apiKey);
- [How-to: Migration from v2 to v3](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html)
- [v3 Web API Mail Send Helper](https://github.com/sendgrid/sendgrid-csharp/tree/master/SendGrid/SendGrid/Helpers/Mail)

<a name="use_cases">
<a name="use_cases"></a>
# Use Cases

[Examples of common API use cases](https://github.com/sendgrid/sendgrid-csharp/blob/master/USE_CASES.md), such as how to send an email with a transactional template.
Expand Down
7 changes: 4 additions & 3 deletions nuspec/Sendgrid.9.1.0.nuspec → nuspec/Sendgrid.9.1.1.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Sendgrid</id>
<version>9.1.0</version>
<version>9.1.1</version>
<title>SendGrid</title>
<authors>Elmer Thomas,SendGrid DX Team</authors>
<licenseUrl>https://github.com/sendgrid/sendgrid-csharp/blob/master/MIT.LICENSE</licenseUrl>
Expand All @@ -11,8 +11,9 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>C# client library and examples for using SendGrid API's to send mail and access Web API v3 endpoints with .NET Standard 1.3 and .NET Core support. Github repo located at : https://github.com/sendgrid/sendgrid-csharp</description>
<summary>C# client library and examples for using SendGrid API's to send mail and access Web API v3 endpoints with .NET Standard 1.3 and .NET Core support.</summary>
<releaseNotes>- PR #405: Reuse HTTP Client
- Thanks to [Jonny Bekkum](https://github.com/jonnybee) for the PR!</releaseNotes>
<releaseNotes>## Fix
- PR #358: SendGridClient.SendEmailAsync now throws original exception
- Thanks to [Otto Dandenell](https://github.com/ottomatic) for the PR!</releaseNotes>
<copyright>SendGrid, Inc. 2017</copyright>
<tags>SendGrid Email Mail Microsoft Azure Transactional .NET Core</tags>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion src/SendGrid/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("377c20e4-2297-488f-933b-fb635c56d8fc")]

[assembly: AssemblyInformationalVersion("9.1.0")]
[assembly: AssemblyInformationalVersion("9.1.1")]
22 changes: 9 additions & 13 deletions src/SendGrid/SendGridClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public class SendGridClient
/// <returns>Interface to the SendGrid REST API</returns>
public SendGridClient(IWebProxy webProxy, string apiKey, string host = null, Dictionary<string, string> requestHeaders = null, string version = "v3", string urlPath = null)
{

// Create client with WebProxy if set
if (webProxy != null)
{
Expand All @@ -75,7 +74,7 @@ public SendGridClient(IWebProxy webProxy, string apiKey, string host = null, Dic
}

/// <summary>
/// Constructor. Initializes a new instance of the <see cref="SendGridClient"/> class.
/// Initializes a new instance of the <see cref="SendGridClient"/> class.
/// </summary>
/// <param name="httpClient">An optional http client which may me injected in order to facilitate testing.</param>
/// <param name="apiKey">Your SendGrid API key.</param>
Expand All @@ -84,14 +83,13 @@ public SendGridClient(IWebProxy webProxy, string apiKey, string host = null, Dic
/// <param name="version">API version, override AddVersion to customize</param>
/// <param name="urlPath">Path to endpoint (e.g. /path/to/endpoint)</param>
/// <returns>Interface to the SendGrid REST API</returns>
public SendGridClient(HttpClient httpClient, string apiKey, string host = null, Dictionary<string, string> requestHeaders = null, string version = "v3", string urlPath = null)
public SendGridClient(HttpClient httpClient, string apiKey, string host = null, Dictionary<string, string> requestHeaders = null, string version = "v3", string urlPath = null)
{
client = (httpClient == null) ? new HttpClient() : httpClient;

InitiateClient(apiKey, host, requestHeaders, version, urlPath);
}


/// <summary>
/// Initializes a new instance of the <see cref="SendGridClient"/> class.
/// </summary>
Expand All @@ -102,18 +100,18 @@ public SendGridClient(HttpClient httpClient, string apiKey, string host = null,
/// <param name="urlPath">Path to endpoint (e.g. /path/to/endpoint)</param>
/// <returns>Interface to the SendGrid REST API</returns>
public SendGridClient(string apiKey, string host = null, Dictionary<string, string> requestHeaders = null, string version = "v3", string urlPath = null)
: this(httpClient: null, apiKey: apiKey,host: host, requestHeaders: requestHeaders, version: version, urlPath: urlPath)
: this(httpClient: null, apiKey: apiKey, host: host, requestHeaders: requestHeaders, version: version, urlPath: urlPath)
{
}

/// <summary>
/// Common method to initiate internal fields regardless of which constructor was used.
/// </summary>
/// <param name="apiKey"></param>
/// <param name="host"></param>
/// <param name="requestHeaders"></param>
/// <param name="version"></param>
/// <param name="urlPath"></param>
/// <param name="apiKey">Your SendGrid API key.</param>
/// <param name="host">Base url (e.g. https://api.sendgrid.com)</param>
/// <param name="requestHeaders">A dictionary of request headers</param>
/// <param name="version">API version, override AddVersion to customize</param>
/// <param name="urlPath">Path to endpoint (e.g. /path/to/endpoint)</param>
private void InitiateClient(string apiKey, string host, Dictionary<string, string> requestHeaders, string version, string urlPath)
{
UrlPath = urlPath;
Expand All @@ -122,7 +120,6 @@ private void InitiateClient(string apiKey, string host, Dictionary<string, strin
var baseAddress = host ?? "https://api.sendgrid.com";
var clientVersion = GetType().GetTypeInfo().Assembly.GetName().Version.ToString();


// standard headers
client.BaseAddress = new Uri(baseAddress);
Dictionary<string, string> headers = new Dictionary<string, string>
Expand Down Expand Up @@ -160,7 +157,6 @@ private void InitiateClient(string apiKey, string host, Dictionary<string, strin
client.DefaultRequestHeaders.Add(header.Key, header.Value);
}
}

}

/// <summary>
Expand Down Expand Up @@ -226,7 +222,7 @@ public virtual AuthenticationHeaderValue AddAuthorization(KeyValuePair<string, s
/// <param name="urlPath">The path to the API endpoint.</param>
/// <param name="cancellationToken">Cancel the asynchronous call.</param>
/// <returns>Response object</returns>
/// <exception cref="Exception">The method will NOT catch and swallow exceptions generated by sending a request
/// <exception cref="Exception">The method will NOT catch and swallow exceptions generated by sending a request
/// through the internal http client. Any underlying exception will pass right through.
/// In particular, this means that you may expect
/// a TimeoutException if you are not connected to the internet.</exception>
Expand Down
2 changes: 1 addition & 1 deletion src/SendGrid/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@
}
}
},
"version": "9.1.0"
"version": "9.1.1"
}
7 changes: 0 additions & 7 deletions tests/SendGrid.Tests/Integration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public class IntegrationFixture : IDisposable
{
public IntegrationFixture()
{

if (Environment.GetEnvironmentVariable("TRAVIS") != "true")
{
Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
Expand Down Expand Up @@ -5797,7 +5796,6 @@ public async Task TestTakesHttpClientFactoryAsConstructorArgumentAndUsesItInHttp
Assert.Equal(httpResponse, response.Body.ReadAsStringAsync().Result);
}


/// <summary>
/// Tests the conditions in issue #358.
/// When an Http call times out while sending a message,
Expand Down Expand Up @@ -5843,10 +5841,7 @@ public async Task TestWhenHttpCallTimesOutThenExceptionIsThrown()
// If we are certain that we don't want custom exceptions to be thrown,
// we can also test that the original exception was thrown
Assert.IsType(typeof(TimeoutException), thrownException);


}

}

public class FakeHttpMessageHandler : HttpMessageHandler
Expand Down Expand Up @@ -5880,7 +5875,6 @@ public override HttpResponseMessage Send(HttpRequestMessage request)
Content = new StringContent(message)
};
}

}

/// <summary>
Expand All @@ -5904,6 +5898,5 @@ public override HttpResponseMessage Send(HttpRequestMessage request)
Thread.Sleep(timeOutMilliseconds);
throw new TimeoutException(exceptionMessage);
}

}
}

0 comments on commit aa6c700

Please sign in to comment.