From ffc3727a1e454fe34ad14504d8d3811480dc5913 Mon Sep 17 00:00:00 2001 From: alesito85 Date: Tue, 28 Feb 2023 13:48:15 +0100 Subject: [PATCH] Fixes insecure and timeout flags (#8255) # Description Fixes #8098 by properly parsing `insecure` flag and also fixes the `timeout` flag, which is described as `max-time` (from curl?). # User-Facing Changes The only change is that the flags now work. # Tests + Formatting Everything passes. # Screenshots Before ![image](https://user-images.githubusercontent.com/4399118/221845043-6dfba69d-daea-49a7-b55c-7ee628551b1c.png) After ![image](https://user-images.githubusercontent.com/4399118/221845382-0111cbe9-4ba6-4de1-9e2a-655efbc65a26.png) --- crates/nu-command/src/network/http/get.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/nu-command/src/network/http/get.rs b/crates/nu-command/src/network/http/get.rs index 7f040d1714..9ed3068507 100644 --- a/crates/nu-command/src/network/http/get.rs +++ b/crates/nu-command/src/network/http/get.rs @@ -140,7 +140,7 @@ struct Arguments { content_type: Option, content_length: Option, raw: bool, - insecure: Option, + insecure: bool, user: Option, password: Option, timeout: Option, @@ -159,10 +159,10 @@ fn run_get( 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) } @@ -178,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.get(url); if let Some(data) = args.data {