mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 02:53:31 +01:00
feat(rest)!: allow passing tokens per request (#10682)
BREAKING CHANGE: `RequestData.authPrefix` has been removed in favor of `RequestData.auth.prefix`
This commit is contained in:
@@ -184,7 +184,7 @@ test('getAuth', async () => {
|
||||
(from) => ({ auth: (from.headers as unknown as Record<string, string | undefined>).Authorization ?? null }),
|
||||
responseOptions,
|
||||
)
|
||||
.times(3);
|
||||
.times(5);
|
||||
|
||||
// default
|
||||
expect(await api.get('/getAuth')).toStrictEqual({ auth: 'Bot A-Very-Fake-Token' });
|
||||
@@ -202,6 +202,20 @@ test('getAuth', async () => {
|
||||
auth: true,
|
||||
}),
|
||||
).toStrictEqual({ auth: 'Bot A-Very-Fake-Token' });
|
||||
|
||||
// Custom Bot Auth
|
||||
expect(
|
||||
await api.get('/getAuth', {
|
||||
auth: { token: 'A-Very-Different-Fake-Token' },
|
||||
}),
|
||||
).toStrictEqual({ auth: 'Bot A-Very-Different-Fake-Token' });
|
||||
|
||||
// Custom Bearer Auth
|
||||
expect(
|
||||
await api.get('/getAuth', {
|
||||
auth: { token: 'A-Bearer-Fake-Token', prefix: 'Bearer' },
|
||||
}),
|
||||
).toStrictEqual({ auth: 'Bearer A-Bearer-Fake-Token' });
|
||||
});
|
||||
|
||||
test('getReason', async () => {
|
||||
|
||||
Reference in New Issue
Block a user