compatibility fix of rumtime and legacy node

This commit is contained in:
cmachsocket
2026-09-14 21:13:16 +08:00
parent a8c781fd64
commit 9a16c89714
2 changed files with 8 additions and 3 deletions
+5 -1
View File
@@ -440,7 +440,11 @@ const createRequest = async (uri, data, options) => {
!cookie.NMTID
) {
NMTID_RETRIES_LEFT--
answer.cookie = setCookies.map((x) => {
answer.cookie = (
typeof res.headers['set-cookie'] === 'string' // node 20 版本以前,可能解析为String
? [res.headers['set-cookie']]
: res.headers['set-cookie'] || []
).map((x) => {
const cleaned = cleanCookie(x)
const match = x.match(/(?:^|;\s*)NMTID=([^;]+)/)
if (match) {