From 38a75fe599a2b96d2d5fe12f2e4630ae4f17a102 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 22 Oct 2021 18:25:08 +0200 Subject: [PATCH] fix: avoid optional chaining for sake of webpack4 --- src/fetch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fetch.ts b/src/fetch.ts index e7b61d2..bb5f275 100644 --- a/src/fetch.ts +++ b/src/fetch.ts @@ -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') }