From: Dan Brown Date: Tue, 3 Sep 2019 20:46:46 +0000 (+0100) Subject: Fixed issue preventing FormData posting correctly X-Git-Tag: v0.27.3~1^2 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/16d8a667b164b60623785ab89f8a1db41fd8b680 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 --- 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); }