mirror of
https://github.com/nushell/nushell.git
synced 2025-04-09 21:28:55 +02: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",
|
"the password when authenticating",
|
||||||
Some('p'),
|
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(
|
.named(
|
||||||
"max-time",
|
"max-time",
|
||||||
SyntaxShape::Int,
|
SyntaxShape::Int,
|
||||||
@ -113,16 +106,6 @@ impl Command for SubCommand {
|
|||||||
example: "http get -H [my-header-key my-header-value] https://www.example.com",
|
example: "http get -H [my-header-key my-header-value] https://www.example.com",
|
||||||
result: None,
|
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 {
|
struct Arguments {
|
||||||
url: Value,
|
url: Value,
|
||||||
headers: Option<Value>,
|
headers: Option<Value>,
|
||||||
data: Option<Value>,
|
|
||||||
content_type: Option<String>,
|
|
||||||
raw: bool,
|
raw: bool,
|
||||||
insecure: bool,
|
insecure: bool,
|
||||||
user: Option<String>,
|
user: Option<String>,
|
||||||
@ -148,8 +129,6 @@ fn run_get(
|
|||||||
let args = Arguments {
|
let args = Arguments {
|
||||||
url: call.req(engine_state, stack, 0)?,
|
url: call.req(engine_state, stack, 0)?,
|
||||||
headers: call.get_flag(engine_state, stack, "headers")?,
|
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"),
|
raw: call.has_flag("raw"),
|
||||||
insecure: call.has_flag("insecure"),
|
insecure: call.has_flag("insecure"),
|
||||||
user: call.get_flag(engine_state, stack, "user")?,
|
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_authorization_header(args.user, args.password, request);
|
||||||
request = request_add_custom_headers(args.headers, 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(
|
request_handle_response(
|
||||||
engine_state,
|
engine_state,
|
||||||
stack,
|
stack,
|
||||||
|
Loading…
Reference in New Issue
Block a user