lefengyang
2026-08-20 d01a28cb030b2cb0ff1d42273c877a0f728519a6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36";
const DEFAULT_HEADERS = {
    "X-Platform": "web",
    "User-Agent": DEFAULT_USER_AGENT,
    Accept:'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7'
};
 
export function wrappedFetch(url: string | URL, options: RequestInit = {}): Promise<Response> {
    const headers: any = {
        ...DEFAULT_HEADERS,
        ...options.headers,
    };
 
    const config: RequestInit = {
        ...options,
        headers,
    };
 
    return fetch(url, config);
}