1

i'm trying to post recorded audio file to server using react native 0.59.8 and android. but getting error: "network request failed", after searching found some solution like: adding "android:usesCleartextTraffic="true"" to manifest file but it failed again. some post mentioned about adding "flipper" to mainapplication.java but i didn't try it. my function:

        var body = new FormData()
        body.append('clipId', clipId);
        body.append('audio', file);
        console.log(body);
        let callRep = await fetch('https://url', {
            method: 'POST',
            headers: {
                'Accept': 'application/json',
                'Content-Type': 'multipart/form-data',
                'token': user.Token
            },
            body: body
        });
        let rep = await callRep.json();
        console.log(rep);

why it's not posting like postman?

0 Answers0