mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +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) {
|
async makeRequest(method, route, options) {
|
||||||
if (rest.isProxied) {
|
if (rest.isProxied) {
|
||||||
if (rest.authorization !== undefined) {
|
if (rest.authorization) {
|
||||||
options ??= {}
|
options ??= {}
|
||||||
options.headers ??= {}
|
options.headers ??= {}
|
||||||
options.headers[rest.authorizationHeader] = rest.authorization
|
options.headers[rest.authorizationHeader] = rest.authorization
|
||||||
|
|||||||
@@ -154,12 +154,12 @@ export interface CreateRestManagerOptions {
|
|||||||
*/
|
*/
|
||||||
baseUrl: string
|
baseUrl: string
|
||||||
/** The authorization header value to attach when sending requests to the proxy. */
|
/** 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
|
* The authorization header name to use when sending requests to the proxy
|
||||||
*
|
*
|
||||||
* @remarks
|
* @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
|
* the requests uses OAuth2 Bearer tokens / Basic tokens
|
||||||
*
|
*
|
||||||
* @default "authorization" // For compatibility purposes
|
* @default "authorization" // For compatibility purposes
|
||||||
|
|||||||
Reference in New Issue
Block a user