mirror of
https://github.com/nushell/nushell.git
synced 2025-03-28 08:36:09 +01:00
Remove body parameters from http get
(#8336)
`http get` has 2 parameters which are used for setting the body of the HTTP request. They don't make sense because [GET requests should have no body](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET): 
This commit is contained in:
parent
48b4471382
commit
4898750fc1
@ -39,13 +39,6 @@ impl Command for SubCommand {
|
||||
"the password when authenticating",
|
||||
Some('p'),
|
||||
)
|
||||
.named("data", SyntaxShape::Any, "the content to post", Some('d'))
|
||||
.named(
|
||||
"content-type",
|
||||
SyntaxShape::Any,
|
||||
"the MIME type of content to post",
|
||||
Some('t'),
|
||||
)
|
||||
.named(
|
||||
"max-time",
|
||||
SyntaxShape::Int,
|
||||
@ -113,16 +106,6 @@ impl Command for SubCommand {
|
||||
example: "http get -H [my-header-key my-header-value] https://www.example.com",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Get content from example.com, with body",
|
||||
example: "http get -d 'body' https://www.example.com",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Get content from example.com, with JSON body",
|
||||
example: "http get -t application/json -d { field: value } https://www.example.com",
|
||||
result: None,
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -130,8 +113,6 @@ impl Command for SubCommand {
|
||||
struct Arguments {
|
||||
url: Value,
|
||||
headers: Option<Value>,
|
||||
data: Option<Value>,
|
||||
content_type: Option<String>,
|
||||
raw: bool,
|
||||
insecure: bool,
|
||||
user: Option<String>,
|
||||
@ -148,8 +129,6 @@ fn run_get(
|
||||
let args = Arguments {
|
||||
url: call.req(engine_state, stack, 0)?,
|
||||
headers: call.get_flag(engine_state, stack, "headers")?,
|
||||
data: call.get_flag(engine_state, stack, "data")?,
|
||||
content_type: call.get_flag(engine_state, stack, "content-type")?,
|
||||
raw: call.has_flag("raw"),
|
||||
insecure: call.has_flag("insecure"),
|
||||
user: call.get_flag(engine_state, stack, "user")?,
|
||||
@ -177,7 +156,7 @@ fn helper(
|
||||
request = request_add_authorization_header(args.user, args.password, request);
|
||||
request = request_add_custom_headers(args.headers, request)?;
|
||||
|
||||
let response = send_request(request, span, args.data, args.content_type);
|
||||
let response = send_request(request, span, None, None);
|
||||
request_handle_response(
|
||||
engine_state,
|
||||
stack,
|
||||
|
Loading…
Reference in New Issue
Block a user