mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2026-04-07 07:43:14 +08:00
feat: url 支持 credentials; 修改导出文件名格式
This commit is contained in:
11
backend/src/vendor/open-api.js
vendored
11
backend/src/vendor/open-api.js
vendored
@@ -373,6 +373,17 @@ export function HTTP(defaultOptions = { baseURL: '' }) {
|
||||
headersTimeout: opts.timeout,
|
||||
};
|
||||
try {
|
||||
const url = new URL(opts.url);
|
||||
if (url.username || url.password) {
|
||||
opts.headers = {
|
||||
...(opts.headers || {}),
|
||||
Authorization: `Basic ${Buffer.from(
|
||||
`${url.username || ''}:${
|
||||
url.password || ''
|
||||
}`,
|
||||
).toString('base64')}`,
|
||||
};
|
||||
}
|
||||
const response = await request(opts.url, {
|
||||
...opts,
|
||||
method: method.toUpperCase(),
|
||||
|
||||
Reference in New Issue
Block a user