Skip to content

Commit f00162c

Browse files
committed
Add comment to elaborate on not using url.Values
1 parent bd6ebbd commit f00162c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

group/group.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,14 @@ func validateAddContacts(contactIDs []string) error {
183183
}
184184

185185
// addContactsQuery gets a query string to add contacts to a group. We're using
186-
// the alternative "/foo?_method=PUT&key=value" syntax to send the contact IDs
186+
// the alternative "/foo?_method=PUT&key=value" format to send the contact IDs
187187
// as GET params. Sending these in the request body would require a painful
188188
// workaround, as client.Request sends request bodies as JSON by default. See
189189
// also: https://developers.messagebird.com/docs/alternatives.
190+
//
191+
// It should also be noted that we're intentionally not using url.Values for
192+
// building the query string: the API expects `ids[]=foo&ids[]=bar` format,
193+
// while url.Values encodes to `ids=foo&ids=bar`.
190194
func addContactsQuery(contactIDs []string) string {
191195
// Slice's length is one bigger than len(IDs) for the _method param.
192196
params := make([]string, 0, len(contactIDs)+1)

0 commit comments

Comments
 (0)