glitch-javascript-sdk 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -97,8 +97,14 @@ class Requests {
97
97
  public static get<T>(url: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
98
98
 
99
99
  if (params && Object.keys(params).length > 0) {
100
+
100
101
  const queryString = Object.entries(params)
101
- .map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
102
+ .map(([key, value]) => {
103
+ if (Array.isArray(value)) {
104
+ return value.map((item) => `${key}[]=${encodeURIComponent(item)}`).join('&');
105
+ }
106
+ return `${key}=${encodeURIComponent(value)}`;
107
+ })
102
108
  .join('&');
103
109
  url = `${url}?${queryString}`;
104
110
  }