@duque.edits/sdk 1.6.8 → 1.6.9
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/rest/REST.js +12 -5
- package/package.json +1 -1
package/dist/rest/REST.js
CHANGED
|
@@ -115,12 +115,19 @@ class REST extends import_events.default {
|
|
|
115
115
|
if ("cache" in body) delete body.cache;
|
|
116
116
|
if ("rest" in body) delete body.rest;
|
|
117
117
|
if ("guilds" in body) delete body.guilds;
|
|
118
|
+
const methodUpper = method.toUpperCase();
|
|
119
|
+
const hasBody = body !== void 0 && body !== null && methodUpper !== "GET" && methodUpper !== "HEAD";
|
|
118
120
|
const res = await (0, import_undici.request)(url, {
|
|
119
|
-
method:
|
|
120
|
-
headers
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
method: methodUpper,
|
|
122
|
+
headers: {
|
|
123
|
+
...headers,
|
|
124
|
+
...hasBody && { "content-type": "application/json" }
|
|
125
|
+
},
|
|
126
|
+
...hasBody && {
|
|
127
|
+
body: JSON.stringify(body)
|
|
128
|
+
},
|
|
129
|
+
bodyTimeout: 12e4,
|
|
130
|
+
headersTimeout: 12e4
|
|
124
131
|
});
|
|
125
132
|
const responseBody = await res.body.json();
|
|
126
133
|
const { data, message } = responseBody;
|