Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Treatment put

http/upload::put


Inputs

⇥ data: Stream<byte>
⇥ request: Block<PreparedRequest> (http/client::PreparedRequest)
⇥ size: Block<u64>

Outputs

↦ completed: Block<void>
↦ error: Block<string>
↦ failed: Block<void>
↦ finished: Block<void>


Upload data of known size in one prepared request.

The bytes received through data are sent with request, such as one presigned for a small file, while they come, with size as length: nothing is kept, so a failed upload is not sent again.

Once the data is sent and accepted, completed is emitted. If the data is longer or shorter than size, the request is refused, or its connection fails, failed is emitted and error contains the reason, with the status and the <Code> of XML error bodies, never the URL. finished is emitted in every case.

The request is made as given, without the headers of any HttpClient.

graph LR
     T("put()")
     R["〈🟨〉"] -->|request| T
     S["〈11〉"] -->|size| T
     B["… 🟦 🟦 🟦"] -->|data| T

     T -->|completed| C["〈🟩〉"]

     style R fill:#ffffff,stroke:#ffffff
     style S fill:#ffffff,stroke:#ffffff
     style B fill:#ffffff,stroke:#ffffff
     style C fill:#ffffff,stroke:#ffffff