Skip to content

Commit

Permalink
Test body if not null
Browse files Browse the repository at this point in the history
Fixes npm#6
  • Loading branch information
paulfalgout authored Sep 10, 2019
1 parent 5dbd1d7 commit 0a6b201
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion check-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function checkErrors (method, res, startTime, opts) {
method, res, parsed, opts.spec
)
}
} else if (res.status === 401 && /one-time pass/.test(body.toString('utf8'))) {
} else if (res.status === 401 && body && /one-time pass/.test(body.toString('utf8'))) {
// Heuristic for malformed OTP responses that don't include the www-authenticate header.
throw new errors.HttpErrorAuthOTP(
method, res, parsed, opts.spec
Expand Down

0 comments on commit 0a6b201

Please sign in to comment.