Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public override Stream? ContentStream
return _contentStream;
}

return ReadContent().ToStream();
return BufferContent().ToStream();
}
set
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ public async Task ResponseReadContentReturnsContentIfBuffered()

await transport.ProcessSyncOrAsync(message, IsAsync);

BinaryData content = await message.Response!.ReadContentSyncOrAsync(default, IsAsync);
BinaryData content = await message.Response!.BufferContentSyncOrAsync(default, IsAsync);

Assert.AreEqual(message.Response!.Content, content);
}
Expand All @@ -416,7 +416,7 @@ public async Task ResponseReadContentReturnsEmptyWhenNoResponseContent()

await transport.ProcessSyncOrAsync(message, IsAsync);

BinaryData content = await message.Response!.ReadContentSyncOrAsync(default, IsAsync);
BinaryData content = await message.Response!.BufferContentSyncOrAsync(default, IsAsync);

Assert.AreEqual(0, content.ToMemory().Length);
}
Expand All @@ -439,7 +439,7 @@ public async Task ResponseReadContentReturnsEmptyWhenContentStreamNull()
// Explicitly assign ContentStream via property setter
message.Response!.ContentStream = null;

BinaryData content = await message.Response!.ReadContentSyncOrAsync(default, IsAsync);
BinaryData content = await message.Response!.BufferContentSyncOrAsync(default, IsAsync);

Assert.AreEqual(0, content.ToMemory().Length);
}
Expand Down Expand Up @@ -467,7 +467,7 @@ public async Task ResponseReadContentThrowsWhenPositionNonZero()

message.Response!.ContentStream!.ReadByte();

Assert.ThrowsAsync<InvalidOperationException>(async() => { await message.Response!.ReadContentSyncOrAsync(default, IsAsync); });
Assert.ThrowsAsync<InvalidOperationException>(async() => { await message.Response!.BufferContentSyncOrAsync(default, IsAsync); });
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ public static async Task WaitSyncOrAsync(this MockRetryPolicy policy, TimeSpan d
}
}

public static async Task<BinaryData> ReadContentSyncOrAsync(this PipelineResponse response, CancellationToken cancellationToken, bool isAsync)
public static async Task<BinaryData> BufferContentSyncOrAsync(this PipelineResponse response, CancellationToken cancellationToken, bool isAsync)
{
if (isAsync)
{
return await response.ReadContentAsync(cancellationToken).ConfigureAwait(false);
return await response.BufferContentAsync(cancellationToken).ConfigureAwait(false);
}
else
{
return response.ReadContent(cancellationToken);
return response.BufferContent(cancellationToken);
}
}
}