diff --git a/backend/package.json b/backend/package.json index 42a268f6c..d2837d890 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.438", + "version": "2.14.439", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/utils/download.js b/backend/src/utils/download.js index a06785fe7..68293b664 100644 --- a/backend/src/utils/download.js +++ b/backend/src/utils/download.js @@ -172,7 +172,7 @@ export default async function download( `Downloading...\nUser-Agent: ${userAgent}\nTimeout: ${requestTimeout}\nProxy: ${proxy}\nInsecure: ${!!insecure}\nURL: ${url}`, ); try { - const { body, headers } = await http.get({ + const { body, headers, statusCode } = await http.get({ url, ...(proxy ? { proxy } : {}), ...(isLoon && proxy ? { node: proxy } : {}), @@ -180,6 +180,10 @@ export default async function download( ...(proxy ? getPolicyDescriptor(proxy) : {}), ...(insecure ? insecure : {}), }); + $.info(`statusCode: ${statusCode}`); + if (statusCode < 200 || statusCode >= 400) { + throw new Error(`statusCode: ${statusCode}`); + } if (headers) { const flowInfo = getFlowField(headers);