Skip to content

Commit

Permalink
use https command for https:// and remove url protocol prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
dcb9 committed Dec 21, 2022
1 parent ae34c0c commit 220baff
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion httpie/cmdline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 220baff

Please sign in to comment.