h2non / gentleman

Plugin-driven, extensible HTTP client toolkit for Go

Home Page:https://pkg.go.dev/github.com/h2non/gentleman?tab=doc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why multipart.DataFields use map[string]string to contain the request form?

elonzh opened this issue · comments

Normally, a form key only has single value, but it's also right with multiple values .

Why not use url.Values ?

If we use Body or BodyString method to make 1:n key-value pair, we need define the proper Content-Type header representing the real content MIME type.

Clearly, this is an interface limitation. It should be map[string][]string, such as url.Values:
https://golang.org/pkg/net/url/#Values

If you want a fast fix, would you mind providing a PR? I will merge it asap!

I'm still reviewing and testing the code. I will try to contribute code later.

commented

I had a few time tonight to fix this. See: b8321b8

The fix will be shipped in gentleman@v1.0.3 soon.

commented

Fix was shipped in gentleman@v1.0.3. You can upgrade it running:

go get -u gopkg.in/h2non/gentleman.v1