fix(discord): sync proxy request client with carbon

This commit is contained in:
Peter Steinberger
2026-04-05 14:01:18 +01:00
parent 760c4be438
commit c731c1e61f

View File

@@ -33,7 +33,7 @@ type Attachment = {
description?: string;
};
const defaultOptions: Required<Omit<RequestClientOptions, "baseUrl" | "tokenHeader">> & {
const defaultOptions: Required<Omit<RequestClientOptions, "baseUrl" | "tokenHeader" | "fetch">> & {
baseUrl: string;
tokenHeader: "Bot" | "Bearer";
} = {
@@ -242,6 +242,7 @@ class ProxyRequestClientCompat {
.join("&")}`
: "";
const url = `${this.options.baseUrl}${path}${queryString}`;
const originalRequest = new Request(url, { method });
const headers =
this.token === "webhook"
? new Headers()
@@ -332,7 +333,7 @@ class ProxyRequestClientCompat {
if (response.status === 429) {
const rateLimitBody = toRateLimitBody(parsedBody, rawBody, response.headers);
const rateLimitError = new RateLimitError(response, rateLimitBody);
const rateLimitError = new RateLimitError(response, rateLimitBody, originalRequest);
this.scheduleRateLimit(
routeKey,
rateLimitError.retryAfter,