mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
Fix Internal proxy Issue (#2413)
* Fix Internal proxy Issue * deno fmt Co-authored-by: meister03 <meisterpi@gmail.com>
This commit is contained in:
+6
-1
@@ -60,7 +60,12 @@ export async function runMethod<T = any>(
|
|||||||
url: route[0] === "/" ? `${BASE_URL}/v${API_VERSION}${route}` : route,
|
url: route[0] === "/" ? `${BASE_URL}/v${API_VERSION}${route}` : route,
|
||||||
method,
|
method,
|
||||||
reject: (data: RestRequestRejection) => {
|
reject: (data: RestRequestRejection) => {
|
||||||
const restError = rest.convertRestError(errorStack, data);
|
const newError = new Error("Location:");
|
||||||
|
newError.stack = errorStack.stack as Error["stack"];
|
||||||
|
const restError = rest.convertRestError(
|
||||||
|
newError,
|
||||||
|
data,
|
||||||
|
);
|
||||||
reject(restError);
|
reject(restError);
|
||||||
},
|
},
|
||||||
respond: (data: RestRequestResponse) =>
|
respond: (data: RestRequestResponse) =>
|
||||||
|
|||||||
+3
-2
@@ -86,11 +86,12 @@ export async function sendRequest<T>(rest: RestManager, options: RestSendRequest
|
|||||||
|
|
||||||
// If NOT rate limited remove from queue
|
// If NOT rate limited remove from queue
|
||||||
if (response.status !== 429) {
|
if (response.status !== 429) {
|
||||||
|
const body = response.type ? JSON.stringify(await response.json()) : undefined;
|
||||||
options.reject?.({
|
options.reject?.({
|
||||||
ok: false,
|
ok: false,
|
||||||
status: response.status,
|
status: response.status,
|
||||||
error,
|
error,
|
||||||
body: response.type ? JSON.stringify(await response.json()) : undefined,
|
body,
|
||||||
});
|
});
|
||||||
|
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -98,7 +99,7 @@ export async function sendRequest<T>(rest: RestManager, options: RestSendRequest
|
|||||||
ok: false,
|
ok: false,
|
||||||
status: response.status,
|
status: response.status,
|
||||||
error,
|
error,
|
||||||
body: response.type ? JSON.stringify(await response.json()) : undefined,
|
body,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user