react-native-ssl-pinning icon indicating copy to clipboard operation
react-native-ssl-pinning copied to clipboard

Cannot POST formData with blob

Open Desintegrator opened this issue 5 years ago • 1 comments

Cannot POST formData with blob, receiving "ReadableNativeMap cannot be cast to java.lang.String" error (btw, such error with boolean values too)

        const formData = new FormData()
        formData.append('base64', base64) // image in string, base64
        formData.append('image', image) // image as a Blob (bytes)
        fetch(url, {
            method: "POST" ,
            body: {
                formData,
            },
            sslPinning: {
                certs: ["..."]
            },
            headers: {
                'content-type': 'multipart/form-data; charset=UTF-8',
                'accept': 'application/json, text/plain, /',
            }
        })

image

Desintegrator avatar Oct 12 '20 11:10 Desintegrator

Hi @Desintegrator this happens because currently library supports only strings or file data in FormData like in the readme. will fix it

MaxToyberman avatar Oct 23 '20 14:10 MaxToyberman