mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
18 lines
423 B
TypeScript
18 lines
423 B
TypeScript
import { ofetch } from 'ofetch';
|
|
import { config } from '@/config';
|
|
import logger from '@/utils/logger';
|
|
|
|
const rofetch = ofetch.create({
|
|
retry: config.requestRetry,
|
|
retryDelay: 1000,
|
|
timeout: config.requestTimeout,
|
|
headers: {
|
|
'user-agent': config.ua,
|
|
},
|
|
onRequestError({ request, error }) {
|
|
logger.error(`Request ${request.url} fail: ${error}`);
|
|
},
|
|
});
|
|
|
|
export default rofetch;
|