Skip to content

Commit

Permalink
ignore tough-cookie/automation failures
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig committed Apr 6, 2020
1 parent 41fb701 commit 4175230
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/server/lib/request.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,10 @@ module.exports = (options = {}) ->

debug('parsing cookie %o', { cyCookie, toughCookie: cookie })

if not cookie
debug('tough-cookie failed to parse, ignoring')
return

cookie.name = cookie.key

if not cookie.domain
Expand All @@ -504,14 +508,18 @@ module.exports = (options = {}) ->
if isFinite(expiry)
cookie.expiry = expiry / 1000

cookie.sameSite = convertSameSiteToughToExtension(cookie.sameSite, cyCookie)

cookie = _.pick(cookie, SERIALIZABLE_COOKIE_PROPS)

if expiry <= 0
return automationFn('clear:cookie', cookie)
automationCmd = 'set:cookie'

cookie.sameSite = convertSameSiteToughToExtension(cookie.sameSite, cyCookie)
if expiry <= 0
automationCmd = 'clear:cookie'

automationFn('set:cookie', cookie)
automationFn(automationCmd, cookie)
.catch (err) ->
debug('automation failed clearing cookie %o', { automationCmd, cookie, err })

sendStream: (headers, automationFn, options = {}) ->
_.defaults options, {
Expand Down

0 comments on commit 4175230

Please sign in to comment.