From 2aa0406a44fd6bcbffeeefa6e3febf540d72db21 Mon Sep 17 00:00:00 2001 From: Rasmus Lindroth Date: Fri, 30 Dec 2022 11:44:05 +0100 Subject: [PATCH] bug fix for AddToList and RemoveFromList --- lists.go | 4 ++-- lists_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lists.go b/lists.go index 59610cc..9256f5d 100644 --- a/lists.go +++ b/lists.go @@ -90,7 +90,7 @@ func (c *Client) DeleteList(ctx context.Context, id ID) error { func (c *Client) AddToList(ctx context.Context, list ID, accounts ...ID) error { params := url.Values{} for _, acct := range accounts { - params.Add("account_ids", string(acct)) + params.Add("account_ids[]", string(acct)) } return c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/lists/%s/accounts", url.PathEscape(string(list))), params, nil, nil) @@ -100,7 +100,7 @@ func (c *Client) AddToList(ctx context.Context, list ID, accounts ...ID) error { func (c *Client) RemoveFromList(ctx context.Context, list ID, accounts ...ID) error { params := url.Values{} for _, acct := range accounts { - params.Add("account_ids", string(acct)) + params.Add("account_ids[]", string(acct)) } return c.doAPI(ctx, http.MethodDelete, fmt.Sprintf("/api/v1/lists/%s/accounts", url.PathEscape(string(list))), params, nil, nil) diff --git a/lists_test.go b/lists_test.go index b1c9e3b..b26bc4a 100644 --- a/lists_test.go +++ b/lists_test.go @@ -235,7 +235,7 @@ func TestAddToList(t *testing.T) { http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) return } - if r.PostFormValue("account_ids") != "1" { + if r.PostFormValue("account_ids[]") != "1" { http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return }