File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -3,10 +3,11 @@ package httpie
33import (
44 "encoding/json"
55 "errors"
6- "github.com/dcb9/curl2httpie/curl"
7- "github.com/dcb9/curl2httpie/httpie"
86 "io/ioutil"
97 "strings"
8+
9+ "github.com/dcb9/curl2httpie/curl"
10+ "github.com/dcb9/curl2httpie/httpie"
1011)
1112
1213type Transformer func (cl * httpie.CmdLine , o * curl.Option )
@@ -44,11 +45,18 @@ func Method(cl *httpie.CmdLine, o *curl.Option) {
4445var ErrUnknownDataType = errors .New ("unknown data type" )
4546
4647func Data (cl * httpie.CmdLine , o * curl.Option ) {
47- s := strings .SplitN (o .Arg , "=" , 2 )
48- if len (s ) == 2 {
49- i := httpie .NewDataField (s [0 ], s [1 ])
50- cl .AddItem (i )
51- cl .HasBody = true
48+ args := strings .Split (o .Arg , "&" )
49+ var urlEncoded bool
50+ for _ , arg := range args {
51+ s := strings .SplitN (arg , "=" , 2 )
52+ if len (s ) == 2 {
53+ i := httpie .NewDataField (s [0 ], s [1 ])
54+ cl .AddItem (i )
55+ cl .HasBody = true
56+ urlEncoded = true
57+ }
58+ }
59+ if urlEncoded {
5260 return
5361 }
5462
You can’t perform that action at this time.
0 commit comments