mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
fix: ok statusCode can be 200..299 (#7919)
This commit is contained in:
@@ -253,6 +253,21 @@ test('postEcho', async () => {
|
|||||||
expect(await api.post('/postEcho', { body: { foo: 'bar' } })).toStrictEqual({ foo: 'bar' });
|
expect(await api.post('/postEcho', { body: { foo: 'bar' } })).toStrictEqual({ foo: 'bar' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('201 status code', async () => {
|
||||||
|
mockPool
|
||||||
|
.intercept({
|
||||||
|
path: genPath('/postNon200StatusCode'),
|
||||||
|
method: 'POST',
|
||||||
|
})
|
||||||
|
.reply((t) => ({
|
||||||
|
data: t.body!,
|
||||||
|
statusCode: 201,
|
||||||
|
responseOptions,
|
||||||
|
}));
|
||||||
|
|
||||||
|
expect(await api.post('/postNon200StatusCode', { body: { foo: 'bar' } })).toStrictEqual({ foo: 'bar' });
|
||||||
|
});
|
||||||
|
|
||||||
test('Old Message Delete Edge-Case: Old message', async () => {
|
test('Old Message Delete Edge-Case: Old message', async () => {
|
||||||
mockPool
|
mockPool
|
||||||
.intercept({
|
.intercept({
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ export class SequentialHandler implements IHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status === 200) {
|
if (status >= 200 && status < 300) {
|
||||||
return parseResponse(res);
|
return parseResponse(res);
|
||||||
} else if (status === 429) {
|
} else if (status === 429) {
|
||||||
// A rate limit was hit - this may happen if the route isn't associated with an official bucket hash yet, or when first globally rate limited
|
// A rate limit was hit - this may happen if the route isn't associated with an official bucket hash yet, or when first globally rate limited
|
||||||
|
|||||||
Reference in New Issue
Block a user