Skip to content

Commit 14c0a52

Browse files
ReceiveData was null when httpclient response is chunked.
Issue:103474
1 parent 21752ba commit 14c0a52

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

dotnet/src/dotnetframework/GxClasses/Domain/GxHttpClient.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ internal byte[] ReceiveData
134134
{
135135
get
136136
{
137+
if (_chunkedResponse && _receiveData == null && _receiveStream!=null)
138+
{
139+
using (MemoryStream memstream = new MemoryStream())
140+
{
141+
_receiveStream.BaseStream.CopyTo(memstream);
142+
_receiveData = memstream.ToArray();
143+
}
144+
}
137145
return _receiveData;
138146
}
139147
}
@@ -739,6 +747,7 @@ void ReadReponseContent(HttpResponseMessage response)
739747
_encoding = Encoding.UTF8;
740748

741749
_receiveStream = new StreamReader(stream, _encoding);
750+
_receiveData = null;
742751
}
743752
else
744753
{
@@ -1520,6 +1529,7 @@ protected virtual void Dispose(bool disposing)
15201529
{
15211530
_receiveData = null;
15221531
_sendStream?.Dispose();
1532+
_receiveStream?.Dispose();
15231533
}
15241534
disposedValue = true;
15251535
}

0 commit comments

Comments
 (0)