You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using sendObjectsAsJsonBlob option ng-file-upload uses "formData.append(key, new Blob([val], {type: 'application/json'}));" code to add object to the form data. The problem is, that browser before sending the data converts object to string, which in case of normal object leads to sending of "[object Object]" string to the server.
Right now to fix this issue I have to pass "new String(angular.toJson(object))" to the upload method to omit the "angular.isString(val)" condition, which is adding string without the "application/json" type. Then the serialization is calling toString() method on the String object, which is returning the proper JSON representation of the object.
I think that the library should call "formData.append(key, new Blob([JSON.stringify(val)], {type: 'application/json'}));" to fix this issue.
The text was updated successfully, but these errors were encountered:
When using sendObjectsAsJsonBlob option ng-file-upload uses "formData.append(key, new Blob([val], {type: 'application/json'}));" code to add object to the form data. The problem is, that browser before sending the data converts object to string, which in case of normal object leads to sending of "[object Object]" string to the server.
Right now to fix this issue I have to pass "new String(angular.toJson(object))" to the upload method to omit the "angular.isString(val)" condition, which is adding string without the "application/json" type. Then the serialization is calling toString() method on the String object, which is returning the proper JSON representation of the object.
I think that the library should call "formData.append(key, new Blob([JSON.stringify(val)], {type: 'application/json'}));" to fix this issue.
The text was updated successfully, but these errors were encountered: