Skip to content

HttpContent: Buffering is implementation dependent #10108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 19, 2024
Merged
Changes from 3 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
4 changes: 3 additions & 1 deletion xml/System.Net.Http/HttpContent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ When the `disposing` parameter is `true`, this method releases all resources hel
## Remarks

Note that this method will internally buffer the content unless <xref:System.Net.Http.HttpContent.CreateContentReadStream(System.Threading.CancellationToken)> has been implemented to do otherwise.
For example, when using <see cref="HttpClient"/>, a method such as <see cref="HttpClient.SendAsync"/> returns a class derived from <see cref="HttpContent"/> that conditionally buffers based on what is passed for the `completionOption` parameter.

]]></format>
</remarks>
Expand Down Expand Up @@ -1047,7 +1048,8 @@ When the `disposing` parameter is `true`, this method releases all resources hel
<format type="text/markdown"><![CDATA[

## Remarks
This operation will not block. The returned <xref:System.Threading.Tasks.Task%601> object will complete after all of the stream that represents content has been read.
This operation will not block. The returned <xref:System.Threading.Tasks.Task%601> object will complete after all of the stream that represents content has been read unless <xref:System.Net.Http.HttpContent.CreateContentReadStream(System.Threading.CancellationToken)> has been implemented to do otherwise.
For example, when using <see cref="HttpClient"/>, a method such as <see cref="HttpClient.SendAsync"/> returns a class derived from <see cref="HttpContent"/> that conditionally buffers based on what is passed for the `completionOption` parameter.

Once the operation completes, the <xref:System.Threading.Tasks.Task%601.Result%2A> property on the returned task object contains the stream that represents the HTTP content. The returned stream can then be used to read the content using various stream APIs.

Expand Down