From 9547c106d3d38149dad19914ea344498d8322f55 Mon Sep 17 00:00:00 2001 From: Brian Mortenson Date: Sat, 1 Jul 2023 01:04:30 -0700 Subject: [PATCH] Add useful example to `http options` documentation (#9576) This PR adds a more real-world example of how the new http options is used, as well as some additional information in the description. --- crates/nu-command/src/network/http/options.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/nu-command/src/network/http/options.rs b/crates/nu-command/src/network/http/options.rs index 394428586c..146383cd17 100644 --- a/crates/nu-command/src/network/http/options.rs +++ b/crates/nu-command/src/network/http/options.rs @@ -72,7 +72,7 @@ impl Command for SubCommand { } fn extra_usage(&self) -> &str { - "Performs HTTP OPTIONS operation." + "Performs an HTTP OPTIONS request. Most commonly used for making CORS preflight requests." } fn search_terms(&self) -> Vec<&str> { @@ -111,6 +111,11 @@ impl Command for SubCommand { example: "http options -H [my-header-key-A my-header-value-A my-header-key-B my-header-value-B] https://www.example.com", result: None, }, + Example { + description: "Simulate a browser cross-origin preflight request from www.example.com to media.example.com", + example: "http options https://media.example.com/api/ -H [Origin https://www.example.com Access-Control-Request-Headers \"Content-Type, X-Custom-Header\" Access-Control-Request-Method GET]", + result: None, + }, ] } }