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.
This commit is contained in:
Brian Mortenson 2023-07-01 01:04:30 -07:00 committed by GitHub
parent 88b22a9248
commit 9547c106d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,7 +72,7 @@ impl Command for SubCommand {
} }
fn extra_usage(&self) -> &str { 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> { 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", 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, 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,
},
] ]
} }
} }