mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 01:10:07 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user