update docs

This commit is contained in:
Andrew Stephan
2016-02-23 17:08:45 -05:00
parent bcf6f6ed90
commit 1e61e48628
2 changed files with 74 additions and 15 deletions
+45
View File
@@ -0,0 +1,45 @@
# Changelog
## v1.0.0
- Added getBasicAuthHeader function
- Added necessary iOS framework (Thanks to EddyVerbruggen)
- Request internet permission in android (Thanks to mbektchiev)
- Fix acceptAllCerts doesn't call callbacks (Thanks to EddyVerbruggen)
- Add validateDomainName (Thanks to denisbabineau)
- Add HEAD request support (untested) (Thanks to denisbabineau)
### Potentially Breaking Changes
- Update cordova file plugin dependency (Thanks to denisbabineau)
- useBasicAuthHeader and setHeader are now synchronous functions
- updated AFNetworking to 3.0.4 - only iOS 7+ is now supported
## v0.1.4
- Support for certificates in www/certificates folder (Thanks to EddyVerbruggen)
## v0.1.3
- Update AFNetworking to 2.4.1 for iOS bug fix in Xcode 6
## v0.1.2
- Fixed plugin.xml for case sensitive filesystems (Thanks to andrey-tsaplin)
## v0.1.1
- Fixed a bug that prevented building
## v0.1.0
- Initial release
## Contributions not noted above
- Fixed examples (Thanks to devgeeks)
- Reports SSL Handshake errors rather than giving a generic error (Thanks to devgeeks)
- Exporting http as a module (Thanks to pvsaikrishna)
- Added Limitations section to readme (Thanks to cvillerm)
- Fixed examples (Thanks to hideov)
+29 -15
View File
@@ -8,6 +8,10 @@ Cordova / Phonegap plugin for communicating with HTTP servers. Supports iOS and
- Background threading - all requests are done in a background thread.
- SSL Pinning - read more at [LumberBlog](http://blog.lumberlabs.com/2012/04/why-app-developers-should-care-about.html).
## Updates
Please check [CHANGELOG.md](CHANGELOG.md) for details about updating to a new version.
## Installation
The plugin conforms to the Cordova plugin specification, it can be installed
@@ -32,30 +36,31 @@ You can then inject the cordovaHTTP service into your controllers. The function
This plugin registers a `cordovaHTTP` global on window
## Functions
## Sync Functions
All available functions are documented below. Every function takes a success and error callback function as the last 2 arguments.
### getBasicAuthHeader
This returns an object representing a basic HTTP Authorization header of the form `{'Authorization': 'Basic base64encodedusernameandpassword'}`
var header = cordovaHTTP.getBasicAuthHeader("user", "password");
### useBasicAuth
This sets up all future requests to use Basic HTTP authentication with the given username and password.
cordovaHTTP.useBasicAuth("user", "password", function() {
console.log('success!');
}, function() {
console.log('error :(');
});
cordovaHTTP.useBasicAuth("user", "password");
### setHeader
Set a header for all future requests. Takes a header and a value.
cordovaHTTP.setHeader("Header", "Value", function() {
console.log('success!');
}, function() {
console.log('error :(');
});
cordovaHTTP.setHeader("Header", "Value");
## Async Functions
These functions all take success and error callbacks as their last 2 arguments.
### enableSSLPinning
Enable or disable SSL pinning. To use SSL pinning you must include at least one .cer SSL certificate in your app project. You can pin to your server certificate or to one of the issuing CA certificates. For ios include your certificate in the root level of your bundle (just add the .cer file to your project/target at the root level). For android include your certificate in your project's platforms/android/assets folder. In both cases all .cer files found will be loaded automatically. If you only have a .pem certificate see this [stackoverflow answer](http://stackoverflow.com/a/16583429/3182729). You want to convert it to a DER encoded certificate with a .cer extension.
Enable or disable SSL pinning. This defaults to false.
To use SSL pinning you must include at least one .cer SSL certificate in your app project. You can pin to your server certificate or to one of the issuing CA certificates. For ios include your certificate in the root level of your bundle (just add the .cer file to your project/target at the root level). For android include your certificate in your project's platforms/android/assets folder. In both cases all .cer files found will be loaded automatically. If you only have a .pem certificate see this [stackoverflow answer](http://stackoverflow.com/a/16583429/3182729). You want to convert it to a DER encoded certificate with a .cer extension.
As an alternative, you can store your .cer files in the www/certificates folder.
@@ -66,7 +71,7 @@ As an alternative, you can store your .cer files in the www/certificates folder.
});
### acceptAllCerts
Accept all SSL certificates. Or disable accepting all certificates.
Accept all SSL certificates. Or disable accepting all certificates. This defaults to false.
cordovaHTTP.acceptAllCerts(true, function() {
console.log('success!');
@@ -74,6 +79,15 @@ Accept all SSL certificates. Or disable accepting all certificates.
console.log('error :(');
});
### validateDomainName
Whether or not to validate the domain name in the certificate. This defaults to true.
cordovaHTTP.validateDomainName(false, function() {
console.log('success!');
}, function() {
console.log('error :(');
});
### post<a name="post"></a>
Execute a POST request. Takes a URL, parameters, and headers.
@@ -167,7 +181,7 @@ This plugin utilizes some awesome open source networking libraries. These are b
We made a few modifications to http-request. They can be found in a separate repo here: https://github.com/wymsee/http-request
## Limitations
## Current Limitations
This plugin isn't equivalent to using XMLHttpRequest or Ajax calls in Javascript.
For instance, the following features are currently not supported: