diff --git a/src/embedded/embeddedManager.ts b/src/embedded/embeddedManager.ts index 8376d087..58c6062c 100644 --- a/src/embedded/embeddedManager.ts +++ b/src/embedded/embeddedManager.ts @@ -33,21 +33,11 @@ export class IterableEmbeddedManager { placementIds: number[] ) { try { - const params: any = {}; - if (placementIds.length > 0) { - params.placementIds = placementIds[0]; - if (placementIds.length > 1) { - params.placementIds += placementIds - .slice(1) - .map((id) => `&placementIds=${id}`) - .join(''); - } - } const iterableResult: any = await baseIterableRequest({ method: 'GET', url: ENDPOINTS.get_embedded_messages.route, params: { - ...params, + placementIds, platform: WEB_PLATFORM, sdkVersion: SDK_VERSION, packageName: packageName diff --git a/src/request.ts b/src/request.ts index 02cefe58..b604a68f 100644 --- a/src/request.ts +++ b/src/request.ts @@ -1,4 +1,5 @@ import Axios, { AxiosRequestConfig } from 'axios'; +import qs from 'qs'; import { BASE_URL, STATIC_HEADERS, EU_ITERABLE_API } from './constants'; import { IterablePromise, IterableResponse } from './types'; import { AnySchema, ValidationError } from 'yup'; @@ -46,6 +47,9 @@ export const baseIterableRequest = ( headers: { ...payload.headers, ...STATIC_HEADERS + }, + paramsSerializer: (params) => { + return qs.stringify(params, { arrayFormat: 'repeat' }); } }); } catch (error) {