File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -73,13 +73,16 @@ func parseFancyArgs(args []string, postMode PostMode) (opts Opts) {
7373
7474func normalizeURL (u string ) string {
7575 // If scheme is omitted, use http:
76+ noScheme := false
7677 if ! strings .HasPrefix (u , "http" ) {
7778 if strings .HasPrefix (u , "//" ) {
7879 u = "http:" + u
7980 } else {
8081 u = "http://" + u
8182 }
83+ noScheme = true
8284 }
85+ println (u )
8386 pu , err := url .Parse (u )
8487 if err != nil {
8588 fmt .Print (err )
@@ -91,7 +94,13 @@ func normalizeURL(u string) string {
9194 // If :port is given with no hostname, add localhost
9295 pu .Host = "localhost" + pu .Host
9396 }
94- return pu .String ()
97+ nu := pu .String ()
98+ if noScheme {
99+ // Remove the prefixed scheme added above so we let curl handle deal
100+ // with the default scheme (ie if --proto-default is used)
101+ nu = strings .TrimPrefix (nu , "http://" )
102+ }
103+ return nu
95104}
96105
97106func parseArg (arg string ) (typ argType , name , value string ) {
You can’t perform that action at this time.
0 commit comments