ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
12.35k stars 1.01k forks source link

feat: Native HTTP requests #2177

Closed REPTILEHAUS closed 4 years ago

REPTILEHAUS commented 5 years ago

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

silviogutierrez commented 4 years ago

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!

Kepro commented 4 years ago

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

jcesarmobile commented 4 years ago

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

Blast06 commented 4 years ago

@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)

Kepro commented 4 years ago

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

jcesarmobile commented 4 years ago

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

digaus commented 4 years ago

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

jcesarmobile commented 4 years ago

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

ionitron-bot[bot] commented 2 years ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.