2

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?

7
  • it is the problem of flipper Commented Nov 26, 2020 at 11:46
  • here is the answer stackoverflow.com/a/64445645/8798220 Commented Nov 26, 2020 at 11:49
  • i saw the post, but i didn't see any line of code i"initializeFlipper" at mainapplication .java!? Commented Nov 26, 2020 at 14:33
  • github.com/facebook/react-native/issues/… ? Commented Nov 26, 2020 at 14:59
  • as saied before, i dont see any reactnativeflipper.java in project. are you sure it exist in rn version 59.8 Commented Nov 27, 2020 at 7:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.