Skip to content
This repository was archived by the owner on Jul 30, 2023. It is now read-only.

Commit cfd4072

Browse files
committed
fix(filter empty cookie)
1 parent dff8071 commit cfd4072

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cookie.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cookie.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ function resolvePassedCookieString(headers: Headers = {}): string {
6868
const searchReg = /^cookie$/i;
6969
const key = Object.keys(headers).find(key => Boolean(key.match(searchReg)));
7070
const cookie = headers[key];
71-
return Array.isArray(cookie) ? cookie.reduce((s1, s2) => `${s1}; ${s2}`, '') : cookie;
71+
return Array.isArray(cookie)
72+
? cookie.filter(str => str).reduce((s1, s2) => `${s1}; ${s2}`, '')
73+
: cookie;
7274
}
7375

7476
export function mergeRequestHeaders(url: string, headers = {}): { [key: string]: string } {

0 commit comments

Comments
 (0)