修改下载函数

为默认Headers增加Host,解决一些网站无法下载文件的问题
This commit is contained in:
Alen 2024-07-02 01:07:30 +08:00
parent fa5c7add7a
commit 1457efa9a4

View File

@ -148,6 +148,8 @@ export async function httpDownload(options: string | HttpDownloadOptions): Promi
};
if (typeof options === 'string') {
url = options;
const host = new URL(url).hostname;
headers['Host'] = host;
} else {
url = options.url;
if (options.headers) {