From bc8052625190d11e1122ebadf6b1f800afaf7b09 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Sat, 7 May 2022 19:30:07 -0400 Subject: [PATCH] Send JSON body, not URL param --- internal/api/accounts.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/api/accounts.go b/internal/api/accounts.go index e2f4c4c..6e3a580 100644 --- a/internal/api/accounts.go +++ b/internal/api/accounts.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "net/http" + "strings" "time" "github.com/gorilla/mux" @@ -185,8 +186,8 @@ func (a *api) upsertAccountsHandler(w http.ResponseWriter, r *http.Request) { _ = a.accountRepo.Disassociate(ctx, &acc, &dev) } - url := fmt.Sprintf("https://apollopushserver.xyz/api/new-server-addition?apns_token=%s", apns) - req, err := http.NewRequestWithContext(ctx, "POST", url, nil) + body := fmt.Sprintf(`{"apns_token": "%s"}`, apns) + req, err := http.NewRequestWithContext(ctx, "POST", "https://apollopushserver.xyz/api/new-server-addition", strings.NewReader(body)) req.Header.Set("Authorization", "Bearer 98g5j89aurqwfcsp9khlnvgd38fa15") if err != nil {