From 2c9c4b9911fd392faa6244082688c2e656a93eb2 Mon Sep 17 00:00:00 2001 From: Silver Chen Date: Fri, 2 Aug 2019 20:39:28 +0200 Subject: [PATCH] fix: Bowser.getParser empty string UserAgent error (#246) --- packages/@pollyjs/persister/src/har/log.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@pollyjs/persister/src/har/log.js b/packages/@pollyjs/persister/src/har/log.js index 1fee58fd..905594ac 100644 --- a/packages/@pollyjs/persister/src/har/log.js +++ b/packages/@pollyjs/persister/src/har/log.js @@ -2,8 +2,8 @@ import uniqWith from 'lodash-es/uniqWith'; import Bowser from 'bowser'; const bowser = - 'navigator' in global - ? Bowser.getParser(global.navigator.userAgent || '').getBrowser() + global.navigator && global.navigator.userAgent + ? Bowser.getParser(global.navigator.userAgent).getBrowser() : null; const browser = bowser && bowser.name && bowser.version