From 16d8a667b164b60623785ab89f8a1db41fd8b680 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Tue, 3 Sep 2019 21:46:46 +0100 Subject: [PATCH] Fixed issue preventing FormData posting correctly - Due to migration from Axios, Instances where we were sending FormData were not considered and always converted to JSON which resulted in empty JSON bodies. Related to #1621 --- resources/assets/js/services/http.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/js/services/http.js b/resources/assets/js/services/http.js index 06cc6a04f..06dac9864 100644 --- a/resources/assets/js/services/http.js +++ b/resources/assets/js/services/http.js @@ -67,7 +67,7 @@ async function dataRequest(method, url, data = null) { body: data, }; - if (typeof data === 'object') { + if (typeof data === 'object' && !(data instanceof FormData)) { options.headers = {'Content-Type': 'application/json'}; options.body = JSON.stringify(data); }