Capacitor: feat: Native HTTP requests

Created on 14 Nov 2019  ·  8Comments  ·  Source: ionic-team/capacitor

As with most people I had been using cordova-plugin-advanced-http for native http requests in background thread, which is great, however today I find out that it has a dependency on cordova file plugin which is error'ing whenever I try to do an android build due to unsafe operations.

Its unfortunate as this is the last cordova plugin I am using and I am forced to use 2 cordova plugins as it has deps, even more unfortunate is that the dep is breaking my app in true cordova style.

It would be fantastic to have a capacitor functionality to pass HTTP requests to native APIs ! taking advantage of SSL pinning, background threading etc.

logged 2 issues:
https://github.com/apache/cordova-plugin-file/issues/359
https://github.com/silkimen/cordova-plugin-advanced-http/issues/271

Most helpful comment

reopening since initial work has been done into a HTTP plugin
https://github.com/ionic-team/capacitor/pull/2495

All 8 comments

I agree that first-class support for native HTTP would take Capacitor to the next level. No more CORS, preflight requests, etc.

I also use the Cordova plugin, and ran into the issues @REPTILEHAUS mentioned.

For reference, React Native bundles its own native HTTP library. Maybe it could serve as inspiration for Capacitor? https://github.com/facebook/react-native/tree/master/Libraries/Network

With all that said, thanks for a great library!

yeah, that will be great! we also trying to migrate to the Capacitor and trying to get rid of Cordova plugins

Issues tagged with plugin request are closed but tracked for reactions to gauge interest.

@Kepro @silviogutierrez @REPTILEHAUS Guys, did you find a solution ? or is there any other workaround for this? i've been strugling with cors, and im also can't solve the issues in the servers(i have tried, my backend is in laravel btw)

cordova advanced http plugin is only one solution right now... or allow cors from your server

reopening since initial work has been done into a HTTP plugin
https://github.com/ionic-team/capacitor/pull/2495

reopening since initial work has been done into a HTTP plugin

2495

Nice. Cordova Http plugins is only plugin which prevents me from fully converting to capacitor. Looking forward to the integrated solution.

Edit:
@jcesarmobile

Will there be a HttpBackend interface for Angular's HttpClient? So we can use it like ionic-native-http-connection-backend

closing, the plugin won't be core, has been released as @capacitor-community/http, see for more information https://github.com/ionic-team/capacitor/pull/2495#issuecomment-636209159

Was this page helpful?
0 / 5 - 0 ratings