Method
CopyTo
func CopyTo(destination: OutputStream, cancellationToken: CancellationToken = default) -> Task<Result<void, HttpError>>
Declaring type: HttpContent
Module: System.Web.Http
Assembly: System.Web.dll
Source file: HttpClient.rvn
Copies buffered or streaming content with bounded staging and backpressure.
Parameters
| Name | Type | Description |
|---|---|---|
destination |
OutputStream | Borrowed output; keep it open until completion. |
cancellationToken |
CancellationToken | Cancellation propagates as a cancelled task, including before empty copies. |
Return value
Success after the body is written, or HttpError.Content preserving the stream error. A reused streaming body returns InvalidRequest.
Remarks
Never flushes or closes either stream. Stream content is consumed once, including after failure or cancellation once started. Known lengths stop exactly at that length and reject early EOF; unknown incoming lengths end at EOF. Do not concurrently read, copy, upload or mutate the body. Array bodies are written directly; other sources use at most 1024 staging bytes. This operation does not add HTTP framing.