refactor(rest): make proxy.authorization optional in CreateRestManagerOptions (#3977)

* fix(rest): sending wrong auth header if proxied and no proxy auth is provided

* make proxy.authorization optional in CreateRestManagerOptions instead
This commit is contained in:
Awesome Stickz
2024-11-10 00:28:39 +05:30
committed by GitHub
parent 8188e85115
commit 4e4655b0a2
2 changed files with 3 additions and 3 deletions

View File

@@ -534,7 +534,7 @@ export function createRestManager(options: CreateRestManagerOptions): RestManage
async makeRequest(method, route, options) {
if (rest.isProxied) {
if (rest.authorization !== undefined) {
if (rest.authorization) {
options ??= {}
options.headers ??= {}
options.headers[rest.authorizationHeader] = rest.authorization

View File

@@ -154,12 +154,12 @@ export interface CreateRestManagerOptions {
*/
baseUrl: string
/** The authorization header value to attach when sending requests to the proxy. */
authorization: string
authorization?: string
/**
* The authorization header name to use when sending requests to the proxy
*
* @remarks
* If the `authorization` header is used it will override any authorization that is given even if
* If the header name is set to `authorization`, it will override any authorization that is given even if
* the requests uses OAuth2 Bearer tokens / Basic tokens
*
* @default "authorization" // For compatibility purposes