]> BookStack Code Mirror - bookstack/commitdiff
Fixed issue preventing FormData posting correctly
authorDan Brown <redacted>
Tue, 3 Sep 2019 20:46:46 +0000 (21:46 +0100)
committerDan Brown <redacted>
Tue, 3 Sep 2019 20:46:46 +0000 (21:46 +0100)
- 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

index 06cc6a04ffeab12b73cbfc21b67905f6c6f9e695..06dac9864a4d4523987e61f4009075ea34ed0594 100644 (file)
@@ -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);
     }