Skip to content

Commit 208e40a

Browse files
committed
handle instances where caseless is not defined on response
1 parent 64efa3c commit 208e40a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/util/request-manager.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,9 @@ export default class RequestManager {
433433
}
434434
}
435435

436-
const server = res.caseless.get('server');
437-
438-
if (res.statusCode === 401 && server === 'GitHub.com') {
436+
if (res.statusCode === 401 && res.caseless && res.caseless.get('server') === 'GitHub.com') {
439437
const message = `${res.body.message}. If using GITHUB_TOKEN in your env, check that it is valid.`;
440-
rejectWithoutUrl(new Error(this.reporter.lang('unauthorizedResponse', server, message)));
438+
rejectWithoutUrl(new Error(this.reporter.lang('unauthorizedResponse', res.caseless.get('server'), message)));
441439
}
442440

443441
if (res.statusCode === 401 && res.headers['www-authenticate']) {

0 commit comments

Comments
 (0)