Stored redirect codes in constant

This commit is contained in:
naman-bruno 2025-01-27 15:26:18 +05:30
parent a3dc41651f
commit c0d6f09cd1

View File

@ -11,6 +11,7 @@ const LOCAL_IPV6 = '::1';
const LOCAL_IPV4 = '127.0.0.1';
const LOCALHOST = 'localhost';
const version = electronApp?.app?.getVersion()?.substring(1) ?? "";
const redidrectResponseCodes = [301, 302, 303, 307, 308];
const getTld = (hostname) => {
if (!hostname) {
@ -129,7 +130,7 @@ function makeAxiosInstance({ proxyMode, proxyConfig, requestMaxRedirects, httpsA
const start = error.config.headers['request-start-time'];
error.response.headers['request-duration'] = end - start;
if (error.response && [301, 302, 303, 307, 308].includes(error.response.status)) {
if (error.response && redidrectResponseCodes.includes(error.response.status)) {
if (redirectCount >= requestMaxRedirects) {
const dataBuffer = Buffer.from(error.response.data);