Hi everyone!
I am trying to do a http post call using the Ionic Native Http plugin in order to send a file using a FormData, but it is not working as expected… I attach a piece of my simple code in typescript.
First of all, I generate the formData and after that I call the service that triggers the http post call:
Do the call using the Ionic Http Plugin with the multipart and the formData:
So, the problem that I am facing is that my code is not reaching the debugger inside the .then() method and I don’t know why… of course, neither in the .catch(), so no errors here…
On the another hand, if I delete the .setDataSerializer(‘multipart’) the http plugin displays the following error: "data" argument supports only following data types: Object, so it seems that when I am using the multipart that promise is not executed or is not ended. Has anyone had the same problem?
Why not just use Angular’s HttpClient, with which your entire multipartPost could be replaced by a single line of code, with the additional benefit of being able to easily and cleanly separate out and centralize the authorization handling, so that every HTTP request in your app can get it for free?