HTTP Request - multipart/form-data

Hi folks,
is there any option to call doo.functions.request as multipart/form-data? Code below does not works because boundary is not set.

        var file = new File(["test"])
        var url = "test.url"

        var myHeaders = new Headers();
        myHeaders.append("Accept", "application/json");
        myHeaders.append("Content-Type", "multipart/form-data");

        var data = new FormData()
        data.append("test", "test")
        data.append("file", file)

        var requestOptions = {
            method: "POST",
            headers: myHeaders,
            mode: "no-cors",
            body: data
        };

        var resp = await doo.functions.request.custom(url, requestOptions);
        console.log(resp);

When I remove Content-Type form header, then is automatically appended header text/plain;charset=UTF-8 instead of multipart/data-form;boundary=?

Thank you
Petr

Hi,
after some tests, it can be done by workaround. Use featch instead of doo.functions.request.custom

var file = new File(["test"])
var url = "test.url"

var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");

var data = new FormData()
data.append("test", "test")
data.append("file", file)

var requestOptions = {
    method: "POST",
    headers: myHeaders,
    mode: "no-cors",
    body: data
};

var resp = await fetch(url, requestOptions);
console.log(resp);

Petr

Hi,

thank you for you quick review and response.

Filip