Exemple #1
0
        private byte[] ReadToEnd(Response response)
        {
            if (response.ContentStream == null)
            {
                return(null);
            }

            var memoryStream = new NonSeekableMemoryStream();

            response.ContentStream.CopyTo(memoryStream);
            memoryStream.Reset();
            response.ContentStream = memoryStream;
            return(memoryStream.ToArray());
        }
        private byte[] ReadToEnd(Response response)
        {
            Stream responseContentStream = response.ContentStream;
            if (responseContentStream == null)
            {
                return null;
            }

            var memoryStream = new NonSeekableMemoryStream();
            responseContentStream.CopyTo(memoryStream);
            responseContentStream.Dispose();

            memoryStream.Reset();
            response.ContentStream = memoryStream;
            return memoryStream.ToArray();
        }