Skip to content

Commit

Permalink
feat: 处理状态码
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Dec 12, 2024
1 parent d015c78 commit 9a3cd4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
6 changes: 5 additions & 1 deletion backend/src/utils/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,18 @@ 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 } : {}),
...(isQX && proxy ? { opts: { policy: proxy } } : {}),
...(proxy ? getPolicyDescriptor(proxy) : {}),
...(insecure ? insecure : {}),
});
$.info(`statusCode: ${statusCode}`);
if (statusCode < 200 || statusCode >= 400) {
throw new Error(`statusCode: ${statusCode}`);
}

if (headers) {
const flowInfo = getFlowField(headers);
Expand Down

0 comments on commit 9a3cd4f

Please sign in to comment.