fix error if no second argument passed

This commit is contained in:
Randall Schmidt 2020-11-27 21:44:36 -05:00
parent fb1bfd6bf9
commit 8507c1be1c
3 changed files with 3 additions and 3 deletions

@ -9,7 +9,7 @@ function md5(str) {
async function getResponse(cacheDirPath, requestArguments, bodyFunctionName) {
const [url, requestInit, ...rest] = requestArguments;
const requestParams = requestInit.body
const requestParams = requestInit && requestInit.body
? ({ ...requestInit, body: typeof requestInit.body === 'object' ? requestInit.body.toString() : requestInit.body })
: requestInit;

2
package-lock.json generated

@ -1,6 +1,6 @@
{
"name": "node-fetch-cache",
"version": "1.0.5",
"version": "1.0.6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

@ -1,6 +1,6 @@
{
"name": "node-fetch-cache",
"version": "1.0.5",
"version": "1.0.6",
"description": "node-fetch with a persistent cache.",
"main": "index.js",
"scripts": {