Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support cordova-plugin-advanced-http(-2) instead of the actual cordova-plugin-http #1883

Closed
mburger81 opened this issue Aug 10, 2017 · 4 comments

Comments

@mburger81
Copy link
Contributor

I'm submitting a ... (check one with "x")
[ ] bug report
[X] feature request

Current behavior:
At the moment with @ionic-native/http you support the cordova-plugin-http, this plugin does support only in part sending json over a post, it does not handle cookies and it is also not maintained well.

In the web there are two forked projects which does all this amazing features, so I suggest to add one of this new plugins
https://github.com/silkimen/cordova-plugin-advanced-http
https://github.com/LlamaloX/cordova-plugin-advanced-http-2

I tried also to integrate this plugin with your index.ts you used for ionic-native/http but I wasn't able to do this.

It would be very nice and helpfull if you add this to your supported list.

Expected behavior:
Add new plugin with new ionic-native plugin or change the codova plugin integrating new functions in the already existing ionic-native lib.

@janpio
Copy link
Contributor

janpio commented Aug 10, 2017

Do these plugins you linked to have the same API as the original one but only add new functionality or fix broken functionality?

Edit: Investigated a bit myself:

From https://github.com/wymsee/cordova-HTTP:

This plugin registers a cordovaHTTP global on window

From https://github.com/silkimen/cordova-plugin-advanced-http:

This plugin registers a global object located at cordova.plugin.http.

From https://github.com/LlamaloX/cordova-plugin-advanced-http-2:

This plugin registers a global object located at cordova.plugin.http.

So these both use a different global object to put there functionality in than the original plugin, so just replacing the repo will definitely not work.

@mburger81
Copy link
Contributor Author

Yes I saw it to, but with replace I intend, deprecate cordova-HTTP and change ionic-native to use advanced-http.

Those plugin fix some issues and also add one or two new functions which are not implemented yet in ionic-native, but that is not the problem :)

declaring the custom native plugin using window.cordova.plugin.http does works

@Plugin({
    pluginName: 'HTTP',
    plugin: 'cordova-plugin-advanced-http',
    pluginRef: 'window.cordova.plugin.http',
    repo: 'https://github.com/silkimen/cordova-plugin-advanced-http',
    platforms: ['Android', 'iOS']
})

I also added the new function

    /**
     * Set the data serializer which will be used for all future POST and PUT requests. Takes a string representing the name of the serializer.
     * @param dataSerializer {string} The name of the data serializer
     */
    @Cordova({ sync: true })
    setDataSerializer(dataSerializer: string): void { }

So this seems to work great, I'll test it some days

@janpio
Copy link
Contributor

janpio commented Aug 10, 2017

If the previous functionality is not changed, I think it would make sense to create a PR for the current plugin to change the repo and plugin object and add the additional methods.

@mburger81
Copy link
Contributor Author

this pullrequest #1921 and release 4.2.0 resolves this FR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants