Skip to content

Commit 128129d

Browse files
Merge pull request #18 from nillis/patch-1
Cache default httpclient
2 parents 92f16b7 + 1bbd9e8 commit 128129d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

CSharpHTTPClient/Client.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
namespace SendGrid.CSharp.HTTP.Client
1414
{
1515
public class Response
16-
{
16+
{
1717
public HttpStatusCode StatusCode;
1818
public HttpContent Body;
1919
public HttpResponseHeaders Headers;
@@ -63,6 +63,7 @@ public virtual Dictionary<string, string> DeserializeResponseHeaders(HttpRespons
6363

6464
public class Client : DynamicObject
6565
{
66+
private static HttpClient _httpClient = new HttpClient();
6667
public string Host;
6768
public Dictionary <string,string> RequestHeaders;
6869
public string Version;
@@ -194,7 +195,7 @@ private HttpClient BuildHttpClient()
194195
return new HttpClient(httpClientHandler);
195196
}
196197

197-
return new HttpClient();
198+
return _httpClient;
198199
}
199200

200201
/// <summary>

0 commit comments

Comments
 (0)