Skip to content

Commit

Permalink
add connection close on default http client (segmentio#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitri-dev committed May 6, 2024
1 parent f9f6917 commit 4f76571
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Analytics-CSharp/Segment/Analytics/Utilities/HTTPClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ public DefaultHTTPClient(string apiKey, string apiHost = null, string cdnHost =
public override async Task<Response> DoGet(string url)
{
var request = new HttpRequestMessage(HttpMethod.Get, url);
request.Headers.Add("Connection", "close");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

HttpResponseMessage response = await _httpClient.SendAsync(request);
Expand Down Expand Up @@ -214,6 +215,7 @@ public override async Task<Response> DoPost(string url, byte[] data)
streamContent.Headers.Add("Content-Encoding", "gzip");

var request = new HttpRequestMessage(HttpMethod.Post, url);
request.Headers.Add("Connection", "close");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("text/plain"));
request.Content = streamContent;

Expand Down

0 comments on commit 4f76571

Please sign in to comment.