From 927ee42ce0def98cceaf40726129a9784c337883 Mon Sep 17 00:00:00 2001 From: ITOH Date: Wed, 5 Apr 2023 00:24:20 +0200 Subject: [PATCH] fix(rest): set the correct auth header when using proxy (#2969) --- packages/rest/src/manager.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/rest/src/manager.ts b/packages/rest/src/manager.ts index a42775554..8dda9ed54 100644 --- a/packages/rest/src/manager.ts +++ b/packages/rest/src/manager.ts @@ -402,6 +402,12 @@ export function createRestManager(options: CreateRestManagerOptions): RestManage async makeRequest(method, route, options) { if (rest.isProxied) { + if (rest.authorization !== undefined) { + options ??= {} + options.headers ??= {} + options.headers.authorization = rest.authorization + } + const result = await fetch(`${rest.baseUrl}/v${rest.version}${route}`, rest.createRequestBody(method, options)) if (!result.ok) {