Skip to content

Commit

Permalink
fixed incorrect use of defaults() (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
rijk committed Jan 31, 2024
1 parent bffae37 commit 3e6d360
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3e6d360

Please sign in to comment.