@discordjs/rest 2.6.2 → 2.6.3

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/dist/index.mjs CHANGED
@@ -86,7 +86,7 @@ import { CDNRoutes } from "discord-api-types/v10";
86
86
  // src/lib/utils/constants.ts
87
87
  import { getUserAgentAppendix } from "@discordjs/util";
88
88
  import { APIVersion } from "discord-api-types/v10";
89
- var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.6.2)`;
89
+ var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.6.3)`;
90
90
  var DefaultUserAgentAppendix = getUserAgentAppendix();
91
91
  var DefaultRestOptions = {
92
92
  agent: null,
@@ -223,10 +223,29 @@ function serializeSearchParam(value) {
223
223
  }
224
224
  }
225
225
  __name(serializeSearchParam, "serializeSearchParam");
226
- function makeURLSearchParams(options) {
226
+ function makeURLSearchParams(parameters, options = {}) {
227
227
  const params = new URLSearchParams();
228
- if (!options) return params;
229
- for (const [key, value] of Object.entries(options)) {
228
+ if (!parameters) return params;
229
+ const { arrayFormat = "repeat" } = options;
230
+ for (const [key, value] of Object.entries(parameters)) {
231
+ if (Array.isArray(value)) {
232
+ const commaSeparatedElements = arrayFormat === "comma" ? [] : null;
233
+ for (const element of value) {
234
+ const serialized2 = serializeSearchParam(element);
235
+ if (serialized2 === null) {
236
+ continue;
237
+ }
238
+ if (commaSeparatedElements) {
239
+ commaSeparatedElements.push(serialized2);
240
+ } else {
241
+ params.append(key, serialized2);
242
+ }
243
+ }
244
+ if (commaSeparatedElements?.length) {
245
+ params.append(key, commaSeparatedElements.join(","));
246
+ }
247
+ continue;
248
+ }
230
249
  const serialized = serializeSearchParam(value);
231
250
  if (serialized !== null) params.append(key, serialized);
232
251
  }
@@ -1458,7 +1477,7 @@ var REST = class _REST extends AsyncEventEmitter {
1458
1477
  };
1459
1478
 
1460
1479
  // src/shared.ts
1461
- var version = "2.6.2";
1480
+ var version = "2.6.3";
1462
1481
 
1463
1482
  // src/index.ts
1464
1483
  globalThis.FormData ??= FormData2;