luci-base: luci.js: support passing FormData as request payload
authorJo-Philipp Wich <jo@mein.io>
Tue, 3 Sep 2019 14:48:31 +0000 (16:48 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 10 Sep 2019 13:28:16 +0000 (15:28 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/luci.js

index a9ddccf359b23599b50704975a9e36ef4d78488e..b4c727a3997d004d85b2ceb81a9938978720554e 100644 (file)
                                                break;
 
                                        case 'object':
-                                               content = JSON.stringify(opt.content);
-                                               contenttype = 'application/json';
+                                               if (!(opt.content instanceof FormData)) {
+                                                       content = JSON.stringify(opt.content);
+                                                       contenttype = 'application/json';
+                                               }
+                                               else {
+                                                       content = opt.content;
+                                               }
                                                break;
 
                                        default: