From 220bafff9ef13709c72a725fdac61885f2dad176 Mon Sep 17 00:00:00 2001 From: "Du, Chengbin" Date: Wed, 21 Dec 2022 14:14:09 +0800 Subject: [PATCH] use https command for https:// and remove url protocol prefix --- httpie/cmdline.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/httpie/cmdline.go b/httpie/cmdline.go index a1ce85e..565bae0 100644 --- a/httpie/cmdline.go +++ b/httpie/cmdline.go @@ -37,7 +37,15 @@ func (cl *CmdLine) AddItem(i *Item) { func (cl *CmdLine) String() string { // slice s := make([]string, 0, len(cl.Flags)+len(cl.Items)+3) // http method url - s = append(s, "http") + + if strings.HasPrefix(cl.URL, "https://") { + s = append(s, "https") + cl.URL = strings.TrimPrefix(cl.URL, "https://") + } else { + s = append(s, "http") + cl.URL = strings.TrimPrefix(cl.URL, "http://") + } + // flags // default flag