Skip to content

Commit

Permalink
CP-47509: Revisited the setting of response headers to avoid errors w…
Browse files Browse the repository at this point in the history
…hen multiple threads use the same session object (#5990)
  • Loading branch information
edwintorok authored Sep 16, 2024
2 parents ae952af + f8a5f49 commit 7ae0080
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ocaml/sdk-gen/csharp/autogen/src/JsonRpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,17 @@ protected virtual void PerformPostRequest(Stream postStream, Stream responseStre
{
webResponse = (HttpWebResponse)webRequest.GetResponse();

ResponseHeaders = new Dictionary<string, string>();
var newResponseHeaders = new Dictionary<string, string>();

if (webResponse.Headers != null)
{
var keys = webResponse.Headers.AllKeys;
foreach (var key in keys)
ResponseHeaders.Add(key, string.Join(",", webResponse.Headers.Get(key)));
newResponseHeaders.Add(key, string.Join(",", webResponse.Headers.Get(key)));
}

ResponseHeaders = newResponseHeaders;

if (webResponse.StatusCode != HttpStatusCode.OK)
throw new WebException(webResponse.StatusCode.ToString());

Expand Down

0 comments on commit 7ae0080

Please sign in to comment.