From 5cb39235cc4b3425bd1eb8db7dc0f78e46f700a5 Mon Sep 17 00:00:00 2001 From: Matt Bell Date: Mon, 1 Dec 2014 23:42:14 -0800 Subject: [PATCH] commands/http: Fixed bug with client arg querystring --- commands/http/client.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/commands/http/client.go b/commands/http/client.go index fa1c79fe8..daaec0994 100644 --- a/commands/http/client.go +++ b/commands/http/client.go @@ -107,15 +107,21 @@ func getQuery(req cmds.Request) (string, error) { args := req.Arguments() argDefs := req.Command().Arguments - var argDef cmds.Argument - for i, arg := range args { - if i < len(argDefs) { - argDef = argDefs[i] + argDefIndex := 0 + + for _, arg := range args { + argDef := argDefs[argDefIndex] + // skip ArgFiles + for argDef.Type == cmds.ArgFile { + argDefIndex++ + argDef = argDefs[argDefIndex] } - if argDef.Type == cmds.ArgString { - query.Add("arg", arg) + query.Add("arg", arg) + + if len(argDefs) > argDefIndex+1 { + argDefIndex++ } }