Skip to content

Commit e3a0186

Browse files
plchampignyisaacs
authored andcommitted
fix: Add null check on body on 401 errors
PR-URL: #9 Credit: @plchampigny Close: #9 Reviewed-by: @isaacs
1 parent ff5f990 commit e3a0186

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

check-response.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function checkErrors (method, res, startTime, opts) {
9595
method, res, parsed, opts.spec
9696
)
9797
}
98-
} else if (res.status === 401 && /one-time pass/.test(body.toString('utf8'))) {
98+
} else if (res.status === 401 && body != null && /one-time pass/.test(body.toString('utf8'))) {
9999
// Heuristic for malformed OTP responses that don't include the www-authenticate header.
100100
throw new errors.HttpErrorAuthOTP(
101101
method, res, parsed, opts.spec

0 commit comments

Comments
 (0)