Skip to content

Commit

Permalink
fix: Add null check on body on 401 errors
Browse files Browse the repository at this point in the history
PR-URL: #9
Credit: @plchampigny
Close: #9
Reviewed-by: @isaacs
  • Loading branch information
plchampigny authored and isaacs committed Oct 4, 2019
1 parent ff5f990 commit e3a0186
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion check-response.js
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 != null && /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 e3a0186

Please sign in to comment.