fix error if no second argument passed
This commit is contained in:
parent
fb1bfd6bf9
commit
8507c1be1c
2
index.js
2
index.js
@ -9,7 +9,7 @@ function md5(str) {
|
|||||||
|
|
||||||
async function getResponse(cacheDirPath, requestArguments, bodyFunctionName) {
|
async function getResponse(cacheDirPath, requestArguments, bodyFunctionName) {
|
||||||
const [url, requestInit, ...rest] = requestArguments;
|
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, body: typeof requestInit.body === 'object' ? requestInit.body.toString() : requestInit.body })
|
||||||
: requestInit;
|
: requestInit;
|
||||||
|
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-fetch-cache",
|
"name": "node-fetch-cache",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-fetch-cache",
|
"name": "node-fetch-cache",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"description": "node-fetch with a persistent cache.",
|
"description": "node-fetch with a persistent cache.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Reference in New Issue
Block a user