@@ -20,9 +20,10 @@ public class SendGridClient : BaseClient
2020 /// <param name="requestHeaders">A dictionary of request headers.</param>
2121 /// <param name="version">API version, override AddVersion to customize.</param>
2222 /// <param name="urlPath">Path to endpoint (e.g. /path/to/endpoint).</param>
23+ /// <param name="httpErrorAsException">Indicates whether HTTP error responses should be raised as exceptions. Default is false.</param>
2324 /// <returns>Interface to the Twilio SendGrid REST API.</returns>
2425 public SendGridClient ( IWebProxy webProxy , string apiKey , string host = null , Dictionary < string , string > requestHeaders = null , string version = null , string urlPath = null , bool httpErrorAsException = false )
25- : base ( webProxy , buildOptions ( apiKey , host , requestHeaders , version , urlPath ) )
26+ : base ( webProxy , buildOptions ( apiKey , host , requestHeaders , version , urlPath , httpErrorAsException ) )
2627 {
2728 }
2829
@@ -35,9 +36,10 @@ public SendGridClient(IWebProxy webProxy, string apiKey, string host = null, Dic
3536 /// <param name="requestHeaders">A dictionary of request headers.</param>
3637 /// <param name="version">API version, override AddVersion to customize.</param>
3738 /// <param name="urlPath">Path to endpoint (e.g. /path/to/endpoint).</param>
39+ /// <param name="httpErrorAsException">Indicates whether HTTP error responses should be raised as exceptions. Default is false.</param>
3840 /// <returns>Interface to the Twilio SendGrid REST API.</returns>
3941 public SendGridClient ( HttpClient httpClient , string apiKey , string host = null , Dictionary < string , string > requestHeaders = null , string version = null , string urlPath = null , bool httpErrorAsException = false )
40- : base ( httpClient , buildOptions ( apiKey , host , requestHeaders , version , urlPath ) )
42+ : base ( httpClient , buildOptions ( apiKey , host , requestHeaders , version , urlPath , httpErrorAsException ) )
4143 {
4244 }
4345
@@ -51,7 +53,7 @@ public SendGridClient(HttpClient httpClient, string apiKey, string host = null,
5153 /// <param name="urlPath">Path to endpoint (e.g. /path/to/endpoint).</param>
5254 /// <returns>Interface to the Twilio SendGrid REST API.</returns>
5355 public SendGridClient ( string apiKey , string host = null , Dictionary < string , string > requestHeaders = null , string version = null , string urlPath = null )
54- : base ( buildOptions ( apiKey , host , requestHeaders , version , urlPath ) )
56+ : base ( buildOptions ( apiKey , host , requestHeaders , version , urlPath , false ) )
5557 {
5658 }
5759
@@ -76,7 +78,7 @@ public SendGridClient(HttpClient httpClient, SendGridClientOptions options)
7678 {
7779 }
7880
79- private static SendGridClientOptions buildOptions ( string apiKey , string host , Dictionary < string , string > requestHeaders , string version , string urlPath )
81+ private static SendGridClientOptions buildOptions ( string apiKey , string host , Dictionary < string , string > requestHeaders , string version , string urlPath , bool httpErrorAsException )
8082 {
8183 return new SendGridClientOptions
8284 {
@@ -85,6 +87,7 @@ private static SendGridClientOptions buildOptions(string apiKey, string host, Di
8587 RequestHeaders = requestHeaders ?? DefaultOptions . RequestHeaders ,
8688 Version = version ?? DefaultOptions . Version ,
8789 UrlPath = urlPath ?? DefaultOptions . UrlPath ,
90+ HttpErrorAsException = httpErrorAsException
8891 } ;
8992 }
9093 }
0 commit comments