From e1b02dea2bef3ef2a448b813841b59273ee80ad2 Mon Sep 17 00:00:00 2001 From: Shreyas Cholia Date: Thu, 13 May 2021 11:16:07 -0700 Subject: [PATCH] Fix content-type for json --- src/utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index c289a7a..4f867a3 100755 --- a/src/utils.ts +++ b/src/utils.ts @@ -34,9 +34,11 @@ export async function makeRequest(request: types.Request) { } if (body) { if (typeof (body) == "string") { - requestInit.headers['Content-Type'] = 'application/x-www-form-urlencoded'; + requestInit.headers['Content-Type'] = 'application/json'; } else if (body instanceof URLSearchParams) { requestInit.headers['Content-Type'] = 'application/x-www-form-urlencoded'; + } else if (body instanceof FormData) { + requestInit.headers['Content-Type'] = 'application/x-www-form-urlencoded'; } requestInit.body = body; }