Browse Source

updated lu request to handle FormData object

tags/v0.5.0
Robin Thoni 8 years ago
parent
commit
fd7f040578
1 changed files with 9 additions and 4 deletions
  1. 9
    4
      src/DataAccess/lu-request.js

+ 9
- 4
src/DataAccess/lu-request.js View File

@@ -82,11 +82,16 @@
82 82
                     url: url,
83 83
                     method: method,
84 84
                     params: dataGet,
85
-                    data: JSON.stringify(dataPost),
86
-                    headers: {
87
-                        'Content-Type': "application/json"
88
-                    }
85
+                    headers: {}
89 86
                 };
87
+                if (dataPost != null && dataPost.constructor === FormData) {
88
+                    params.data = dataPost;
89
+                    params.headers['Content-Type'] = undefined;
90
+                }
91
+                else {
92
+                    params.data = JSON.stringify(dataPost);
93
+                    params.headers['Content-Type'] = 'application/json';
94
+                }
90 95
 
91 96
                 for (var i = 0; i < luRequest.hooks.before.length; ++i) {
92 97
                     luRequest.hooks.before[i](url, method, dataGet, dataPost, luBusyGroups);

Loading…
Cancel
Save