Skip to content

Commit 092d504

Browse files
committed
更新[EnvJs]: 修复 got 处理重定向请求时的错误
1 parent 41dde8a commit 092d504

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

Env.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,11 @@ function Env(name, opts) {
290290
this.got(opts)
291291
.on('redirect', (resp, nextOpts) => {
292292
try {
293-
const ck = resp.headers['set-cookie'].map(this.cktough.Cookie.parse).toString()
294-
this.ckjar.setCookieSync(ck, null)
295-
nextOpts.cookieJar = this.ckjar
293+
if (resp.headers['set-cookie']) {
294+
const ck = resp.headers['set-cookie'].map(this.cktough.Cookie.parse).toString()
295+
this.ckjar.setCookieSync(ck, null)
296+
nextOpts.cookieJar = this.ckjar
297+
}
296298
} catch (e) {
297299
this.logErr(e)
298300
}
@@ -418,7 +420,7 @@ function Env(name, opts) {
418420
return { 'open-url': openUrl, 'media-url': mediaUrl }
419421
} else if (this.isSurge()) {
420422
let openUrl = rawopts.url || rawopts.openUrl || rawopts['open-url']
421-
return { 'url': openUrl }
423+
return { url: openUrl }
422424
}
423425
} else {
424426
return undefined

Env.min.js

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

0 commit comments

Comments
 (0)