Skip to content

Commit 8f6643e

Browse files
committed
Do not attempt to read from the stream if we have a ResponseWriter callback.
1 parent 31a9019 commit 8f6643e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/RestSharp/Response/RestResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async Task<RestResponse> GetDefaultResponse() {
7878
await using var stream = await readTask.ConfigureAwait(false);
7979
#endif
8080

81-
var bytes = stream == null ? null : await stream.ReadAsBytes(cancellationToken).ConfigureAwait(false);
81+
var bytes = request.ResponseWriter != null || stream == null ? null : await stream.ReadAsBytes(cancellationToken).ConfigureAwait(false);
8282
var content = bytes == null ? null : httpResponse.GetResponseString(bytes, encoding);
8383

8484
return new RestResponse {

0 commit comments

Comments
 (0)