Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyzimarev authored Mar 12, 2022
1 parent 75ca0ae commit 5550efb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/RestSharp/Response/ResponseHandling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ static class ResponseHandling {
public static string GetResponseString(this HttpResponseMessage response, byte[] bytes, Encoding clientEncoding) {
var encodingString = response.Content.Headers.ContentType?.CharSet;
var encoding = encodingString != null ? TryGetEncoding(encodingString) : clientEncoding;
return encoding.GetString(bytes);

using var reader = new StreamReader(new MemoryStream(bytes), encoding);
return reader.ReadToEnd();

Encoding TryGetEncoding(string es) {
try {
Expand Down

0 comments on commit 5550efb

Please sign in to comment.