Skip to content
This repository has been archived by the owner on Apr 2, 2022. It is now read-only.

Use github.com/google/go-querystring for POST/PUT data #24

Open
VojtechVitek opened this issue Feb 24, 2016 · 5 comments
Open

Use github.com/google/go-querystring for POST/PUT data #24

VojtechVitek opened this issue Feb 24, 2016 · 5 comments
Milestone

Comments

@VojtechVitek
Copy link
Owner

No description provided.

@VojtechVitek VojtechVitek added this to the v0.2 milestone Feb 24, 2016
@fiatjaf
Copy link
Contributor

fiatjaf commented Feb 24, 2016

What is the problem with the current approach? (not that I like it, I'm just curious)

@VojtechVitek
Copy link
Owner Author

payload := url.Values{}
payload.Set("name", opts.Name)
payload.Set("desc", opts.Desc)
payload.Set("pos", strconv.Itoa(opts.Pos))
payload.Set("due", opts.Due)
payload.Set("idList", opts.IdList)
payload.Set("idMembers", strings.Join(opts.IdMembers, ","))

vs.

payload, _ := query.Values(opts)

@VojtechVitek
Copy link
Owner Author

basically, github.com/google/go-querystring will serve as a "Marshaller" for URL encoded payloads

@VojtechVitek
Copy link
Owner Author

But I just realized there are edge cases like strings.Join(opts.IdMembers, ",") -- I'm not sure Trello API understands standard URL arrays, like idMembers[]=1 etc.

@fiatjaf
Copy link
Contributor

fiatjaf commented Feb 25, 2016

Let's use JSON instead.

fiatjaf referenced this issue in Luzifer/go-trello Feb 26, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants