i also facing the same issue where as my server required me to send csrf token, and it will only allowed if i use multipart/form-data instead of application/json for Content-Type.
We have not started on this yet. ArrayBuffer support is coming first, then we can look at FormData, thanks for your patiance. You can write something manually from the Uno side if you are stuck.
A workaround I discovered is using XMLHttpRequest.
Following is the working codeblock at my end.
var xhr = new XMLHttpRequest();
var params = "var1=val1&var2=val2";
xhr.open("POST", "<API END POINT>" , true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
// JSON.parse does not evaluate the attacker's scripts.
var resp = JSON.parse(xhr.responseText);
console.log(resp.status);
}
}
xhr.send(params);
Any updates on FormData, or any other alternative way to upload a file?
Don’t want to waste time building a custom request manually if there is a solution already available. Please share update/timeline for this capability.
@jesusmartinoza We have not been able to complete FormData yet. But you can upload a binary this way and here is a community version of how to do multipart upload.