Skip to content

Commit

Permalink
fix: 防止x-forward-for为空 #39
Browse files Browse the repository at this point in the history
  • Loading branch information
weaigc committed Aug 22, 2023
1 parent 329f237 commit 63c7d6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export function mockUser(cookies: Partial<{ [key: string]: string }>) {
const ua = parseUA(BING_UA)

return {
'x-forwarded-for': BING_IP,
'x-forwarded-for': BING_IP || randomIP(),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
'User-Agent': ua!,
Expand All @@ -140,7 +140,7 @@ export function createHeaders(cookies: Partial<{ [key: string]: string }>, type?
BING_HEADER,
...cookies,
}) || {}
headers['x-forward-for'] = BING_IP
headers['x-forward-for'] = BING_IP || randomIP()
return headers
}
}
Expand Down

0 comments on commit 63c7d6d

Please sign in to comment.