From a5413827760bf829ca024a84164105a6b74dfbaa Mon Sep 17 00:00:00 2001 From: Douglas <32344964+NotTheDr01ds@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:49:49 -0500 Subject: [PATCH] Fix binary example and add one for text uploads (#14307) # Description In #14291, I misunderstood the use-case for `into binary` with `http post`. Thanks again to @weirdan for steering me straight on that. This reverts the example that I changed and adds a new one for uploading text files. # User-Facing Changes Doc-only # Tests + Formatting - :green_circle: `toolkit fmt` - :green_circle: `toolkit clippy` - :green_circle: `toolkit test` - :green_circle: `toolkit test stdlib` # After Submitting N/A --- crates/nu-command/src/network/http/post.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/nu-command/src/network/http/post.rs b/crates/nu-command/src/network/http/post.rs index 1d144f7d16..597f9478b9 100644 --- a/crates/nu-command/src/network/http/post.rs +++ b/crates/nu-command/src/network/http/post.rs @@ -128,8 +128,13 @@ impl Command for SubCommand { result: None, }, Example { - description: "Upload a file to example.com", - example: "http post --content-type multipart/form-data https://www.example.com { file: (open -r file.mp3 | into binary) }", + description: "Upload a binary file to example.com", + example: "http post --content-type multipart/form-data https://www.example.com { file: (open -r file.mp3) }", + result: None, + }, + Example { + description: "Convert a text file into binary and upload it to example.com", + example: "http post --content-type multipart/form-data https://www.example.com { file: (open -r file.txt | into binary) }", result: None, }, ]