From 5fd90d002c55f704edea22d7ed42d48b5260fe89 Mon Sep 17 00:00:00 2001 From: Elise Shanholtz Date: Tue, 6 Jul 2021 16:57:08 -0700 Subject: [PATCH] fix: list of stringified json marshaling (#93) --- rest/events/v1/subscriptions.go | 12 +++++++----- rest/proxy/v1/services_sessions.go | 12 +++++++----- rest/verify/v2/services_entities_challenges.go | 12 +++++++----- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/rest/events/v1/subscriptions.go b/rest/events/v1/subscriptions.go index b164bdd8f..95df38d18 100644 --- a/rest/events/v1/subscriptions.go +++ b/rest/events/v1/subscriptions.go @@ -56,13 +56,15 @@ func (c *ApiService) CreateSubscription(params *CreateSubscriptionParams) (*Even data.Set("SinkSid", *params.SinkSid) } if params != nil && params.Types != nil { - v, err := json.Marshal(params.Types) + for _, item := range *params.Types { + v, err := json.Marshal(item) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Types", string(v)) + data.Add("Types", string(v)) + } } resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) diff --git a/rest/proxy/v1/services_sessions.go b/rest/proxy/v1/services_sessions.go index f85b9095d..d39a726e4 100644 --- a/rest/proxy/v1/services_sessions.go +++ b/rest/proxy/v1/services_sessions.go @@ -85,13 +85,15 @@ func (c *ApiService) CreateSession(ServiceSid string, params *CreateSessionParam data.Set("Mode", *params.Mode) } if params != nil && params.Participants != nil { - v, err := json.Marshal(params.Participants) + for _, item := range *params.Participants { + v, err := json.Marshal(item) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Participants", string(v)) + data.Add("Participants", string(v)) + } } if params != nil && params.Status != nil { data.Set("Status", *params.Status) diff --git a/rest/verify/v2/services_entities_challenges.go b/rest/verify/v2/services_entities_challenges.go index 27c4c9a56..0731c1cde 100644 --- a/rest/verify/v2/services_entities_challenges.go +++ b/rest/verify/v2/services_entities_challenges.go @@ -74,13 +74,15 @@ func (c *ApiService) CreateChallenge(ServiceSid string, Identity string, params data.Set("AuthPayload", *params.AuthPayload) } if params != nil && params.DetailsFields != nil { - v, err := json.Marshal(params.DetailsFields) + for _, item := range *params.DetailsFields { + v, err := json.Marshal(item) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Details.Fields", string(v)) + data.Add("Details.Fields", string(v)) + } } if params != nil && params.DetailsMessage != nil { data.Set("Details.Message", *params.DetailsMessage)