nativescript-community / https

Secure HTTP client with SSL pinning for Nativescript - iOS/Android
https://nativescript-community.github.io/https/
Other
50 stars 42 forks source link

Error: Cannot convert number to Ljava/lang/String; at index 1 #83

Closed myst-al closed 3 years ago

myst-al commented 3 years ago

JS: ERROR POST : Error: Cannot convert number to Ljava/lang/String; at index 1

i have an error like this my body :

const params = []

params.push({ parameterName: "accountNumber", data: 1 })
params.push({ parameterName: "imageFile", data: imageFile._path,, fileName: imageFile._path, contentType: 'image/jpeg' })

and this is my request

Https.request({
                url: URL,
                method: "POST",
                timeout: 10000,
                headers: {
                    'Content-Type': 'multipart/form-data'
                },
                body: params
            })
farfromrefug commented 3 years ago

@albert0106 great catch will fix right away! @albert0106 not sure if multipart/form-data is supposed to support sending "numbers". Is that ok if i "convert" your data:1 to data:"1" ? it means your server would receive a string

myst-al commented 3 years ago

@albert0106 great catch will fix right away! @albert0106 not sure if multipart/form-data is supposed to support sending "numbers". Is that ok if i "convert" your data:1 to data:"1" ? it means your server would receive a string

Thankyou for your answer and work for me