mirror of
https://github.com/intergalacticalvariable/reader.git
synced 2024-11-15 19:22:20 +08:00
set cookies properly
This commit is contained in:
parent
49a90ee7d4
commit
66183d8216
|
@ -879,10 +879,13 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`;
|
|||
|
||||
const cookies = req.headers['x-set-cookie'] ?
|
||||
(Array.isArray(req.headers['x-set-cookie']) ? req.headers['x-set-cookie'] : [req.headers['x-set-cookie']])
|
||||
.map(cookie => {
|
||||
const [name, value] = cookie.split('=');
|
||||
return { name, value, url: urlToCrawl.toString() };
|
||||
})
|
||||
.flatMap(cookieString =>
|
||||
cookieString.split(';').map(cookie => {
|
||||
const [name, ...valueParts] = cookie.trim().split('=');
|
||||
const value = valueParts.join('=');
|
||||
return { name, value, url: urlToCrawl.toString() };
|
||||
})
|
||||
)
|
||||
: [];
|
||||
|
||||
console.log('Cookies:', cookies);
|
||||
|
|
Loading…
Reference in New Issue
Block a user