diff --git a/lib/util.js b/lib/util.js index e9a4a69..169d061 100644 --- a/lib/util.js +++ b/lib/util.js @@ -81,9 +81,7 @@ exports.checkArgs = (searchString, options = {}) => { // Unlink requestOptions obj.requestOptions = Object.assign({}, options.requestOptions); // Unlink requestOptions#headers - if (obj.requestOptions.headers) { - obj.requestOptions.headers = clone(obj.requestOptions.headers); - } + obj.requestOptions.headers = obj.requestOptions.headers ? clone(obj.requestOptions.headers) : {}; const cookie = getPropInsensitive(obj.requestOptions.headers, 'cookie'); if (!cookie) { setPropInsensitive(obj.requestOptions.headers, 'cookie', CONSENT_COOKIE);