Skip to content

Commit

Permalink
fix: avoid optional chaining for sake of webpack4
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Oct 22, 2021
1 parent 623c8b0 commit 38a75fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function createFetch ({ fetch }: CreateFetchOptions): $Fetch {
if (opts.params) {
request = withQuery(request, opts.params)
}
if (opts.body && opts.body.toString() === '[object Object]' && payloadMethods.includes(opts.method?.toLowerCase() || '')) {
if (opts.body && opts.body.toString() === '[object Object]' && payloadMethods.includes((opts.method || '').toLowerCase() || '')) {
opts.body = JSON.stringify(opts.body)
setHeader(opts, 'content-type', 'application/json')
}
Expand Down

0 comments on commit 38a75fe

Please sign in to comment.