I cannot find a way using HttpClient to get around Preflight error when trying to upload a photo to an API from an iOS device. Some background:
- I have no control over the server/API (in case it’s a CORS issue)
- The API is configured to accept only multipart/form-data
For the rest of the app, I’ve been using ionic-native http, which has worked great - except it seems it doesn’t support multipart/form-data. For this single call, I tried using angular HttpClient, which is resulting in the preflight errors.
Code is very vanilla … I can post anything anyone would like to see, but it’s nothing out of the ordinary.
I’ve done a lot of Googling on this, and the solutions so far are
- CORS issue, reconfigure the server (not an option for me)
- switch to ionic-native http (due to content-type, not an option for me, unless someone has found a way to make that work)
- downgrade web kit view - doesn’t seem like a very good solution
Has anyone had success doing something similar?