From 3e6d3609974cea445c17e3607320f3ae871ef341 Mon Sep 17 00:00:00 2001 From: Rijk van Wel Date: Wed, 31 Jan 2024 17:00:44 +0100 Subject: [PATCH] fixed incorrect use of defaults() (#130) --- lib/request.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/request.js b/lib/request.js index 4bd1987..54cffcd 100644 --- a/lib/request.js +++ b/lib/request.js @@ -70,11 +70,11 @@ const requestWithFetch = (options, url, payload, callback) => { } if (payload) headers['Content-Type'] = 'application/json' const reqOptions = typeof options.requestOptions === 'function' ? options.requestOptions(payload) : options.requestOptions - const fetchOptions = defaults({ + const fetchOptions = defaults(omitFetchOptions ? {} : reqOptions, { method: payload ? 'POST' : 'GET', body: payload ? options.stringify(payload) : undefined, headers - }, omitFetchOptions ? {} : reqOptions) + }) try { fetchIt(url, fetchOptions, callback) } catch (e) {