diff --git a/crates/nu-command/src/network/http/delete.rs b/crates/nu-command/src/network/http/delete.rs index e27545953d..9cf0fa34e7 100644 --- a/crates/nu-command/src/network/http/delete.rs +++ b/crates/nu-command/src/network/http/delete.rs @@ -139,7 +139,7 @@ struct Arguments { content_type: Option, content_length: Option, raw: bool, - insecure: Option, + insecure: bool, user: Option, password: Option, timeout: Option, @@ -158,11 +158,12 @@ fn run_delete( content_type: call.get_flag(engine_state, stack, "content-type")?, content_length: call.get_flag(engine_state, stack, "content-length")?, raw: call.has_flag("raw"), - insecure: call.get_flag(engine_state, stack, "insecure")?, + insecure: call.has_flag("insecure"), user: call.get_flag(engine_state, stack, "user")?, password: call.get_flag(engine_state, stack, "password")?, - timeout: call.get_flag(engine_state, stack, "timeout")?, + timeout: call.get_flag(engine_state, stack, "max-time")?, }; + helper(engine_state, stack, call, args) } @@ -177,7 +178,7 @@ fn helper( let span = args.url.span()?; let (requested_url, url) = http_parse_url(call, span, args.url)?; - let client = http_client(args.insecure.is_some()); + let client = http_client(args.insecure); let mut request = client.delete(url); if let Some(data) = args.data { diff --git a/crates/nu-command/src/network/http/head.rs b/crates/nu-command/src/network/http/head.rs index d6201859ac..18ce4dffde 100644 --- a/crates/nu-command/src/network/http/head.rs +++ b/crates/nu-command/src/network/http/head.rs @@ -106,7 +106,7 @@ impl Command for SubCommand { struct Arguments { url: Value, headers: Option, - insecure: Option, + insecure: bool, user: Option, password: Option, timeout: Option, @@ -121,11 +121,12 @@ fn run_head( let args = Arguments { url: call.req(engine_state, stack, 0)?, headers: call.get_flag(engine_state, stack, "headers")?, - insecure: call.get_flag(engine_state, stack, "insecure")?, + insecure: call.has_flag("insecure"), user: call.get_flag(engine_state, stack, "user")?, password: call.get_flag(engine_state, stack, "password")?, - timeout: call.get_flag(engine_state, stack, "timeout")?, + timeout: call.get_flag(engine_state, stack, "max-time")?, }; + helper(call, args) } @@ -135,7 +136,7 @@ fn helper(call: &Call, args: Arguments) -> Result { let span = args.url.span()?; let (requested_url, url) = http_parse_url(call, span, args.url)?; - let client = http_client(args.insecure.is_some()); + let client = http_client(args.insecure); let mut request = client.head(url); request = request_set_timeout(args.timeout, request)?; diff --git a/crates/nu-command/src/network/http/patch.rs b/crates/nu-command/src/network/http/patch.rs index 585a7c2f51..3a2b96b6ac 100644 --- a/crates/nu-command/src/network/http/patch.rs +++ b/crates/nu-command/src/network/http/patch.rs @@ -129,7 +129,7 @@ struct Arguments { content_type: Option, content_length: Option, raw: bool, - insecure: Option, + insecure: bool, user: Option, password: Option, timeout: Option, @@ -148,11 +148,12 @@ fn run_patch( content_type: call.get_flag(engine_state, stack, "content-type")?, content_length: call.get_flag(engine_state, stack, "content-length")?, raw: call.has_flag("raw"), - insecure: call.get_flag(engine_state, stack, "insecure")?, + insecure: call.has_flag("insecure"), user: call.get_flag(engine_state, stack, "user")?, password: call.get_flag(engine_state, stack, "password")?, - timeout: call.get_flag(engine_state, stack, "timeout")?, + timeout: call.get_flag(engine_state, stack, "max-time")?, }; + helper(engine_state, stack, call, args) } @@ -167,7 +168,7 @@ fn helper( let span = args.url.span()?; let (requested_url, url) = http_parse_url(call, span, args.url)?; - let client = http_client(args.insecure.is_some()); + let client = http_client(args.insecure); let mut request = client.patch(url); request = request_set_body(args.content_type, args.content_length, args.data, request)?; diff --git a/crates/nu-command/src/network/http/post.rs b/crates/nu-command/src/network/http/post.rs index 3a16e3f415..945108bd3f 100644 --- a/crates/nu-command/src/network/http/post.rs +++ b/crates/nu-command/src/network/http/post.rs @@ -129,7 +129,7 @@ struct Arguments { content_type: Option, content_length: Option, raw: bool, - insecure: Option, + insecure: bool, user: Option, password: Option, timeout: Option, @@ -148,11 +148,12 @@ fn run_post( content_type: call.get_flag(engine_state, stack, "content-type")?, content_length: call.get_flag(engine_state, stack, "content-length")?, raw: call.has_flag("raw"), - insecure: call.get_flag(engine_state, stack, "insecure")?, + insecure: call.has_flag("insecure"), user: call.get_flag(engine_state, stack, "user")?, password: call.get_flag(engine_state, stack, "password")?, - timeout: call.get_flag(engine_state, stack, "timeout")?, + timeout: call.get_flag(engine_state, stack, "max-time")?, }; + helper(engine_state, stack, call, args) } @@ -167,7 +168,7 @@ fn helper( let span = args.url.span()?; let (requested_url, url) = http_parse_url(call, span, args.url)?; - let client = http_client(args.insecure.is_some()); + let client = http_client(args.insecure); let mut request = client.post(url); request = request_set_body(args.content_type, args.content_length, args.data, request)?; diff --git a/crates/nu-command/src/network/http/put.rs b/crates/nu-command/src/network/http/put.rs index f89e7bd126..58779cc147 100644 --- a/crates/nu-command/src/network/http/put.rs +++ b/crates/nu-command/src/network/http/put.rs @@ -129,7 +129,7 @@ struct Arguments { content_type: Option, content_length: Option, raw: bool, - insecure: Option, + insecure: bool, user: Option, password: Option, timeout: Option, @@ -148,11 +148,12 @@ fn run_put( content_type: call.get_flag(engine_state, stack, "content-type")?, content_length: call.get_flag(engine_state, stack, "content-length")?, raw: call.has_flag("raw"), - insecure: call.get_flag(engine_state, stack, "insecure")?, + insecure: call.has_flag("insecure"), user: call.get_flag(engine_state, stack, "user")?, password: call.get_flag(engine_state, stack, "password")?, - timeout: call.get_flag(engine_state, stack, "timeout")?, + timeout: call.get_flag(engine_state, stack, "max-time")?, }; + helper(engine_state, stack, call, args) } @@ -167,7 +168,7 @@ fn helper( let span = args.url.span()?; let (requested_url, url) = http_parse_url(call, span, args.url)?; - let client = http_client(args.insecure.is_some()); + let client = http_client(args.insecure); let mut request = client.put(url); request = request_set_body(args.content_type, args.content_length, args.data, request)?;