mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2026-07-07 00:02:47 +08:00
- added a function to remove all cookies for a URL
- updated change log - incremented version for release
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## v1.5.5
|
||||
|
||||
- added a function to remove all cookies for a URL
|
||||
|
||||
## v1.5.4
|
||||
|
||||
- fixed an error if the response has no "headers" field
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cordova-plugin-advanced-http",
|
||||
"version": "1.5.4",
|
||||
"version": "1.5.5",
|
||||
"description": "Cordova / Phonegap plugin for communicating with HTTP servers using SSL pinning",
|
||||
"scripts": {
|
||||
"build": "cp node_modules/umd-tough-cookie/lib/umd-tough-cookie.js www/umd-tough-cookie.js",
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="cordova-plugin-advanced-http"
|
||||
version="1.5.4">
|
||||
version="1.5.5">
|
||||
|
||||
<name>Advanced HTTP plugin</name>
|
||||
|
||||
|
||||
@@ -143,6 +143,9 @@ var http = {
|
||||
clearCookies: function () {
|
||||
return cookieHandler.clearCookies();
|
||||
},
|
||||
removeCookies: function (url, callback) {
|
||||
cookieHandler.removeCookies(url, callback);
|
||||
},
|
||||
enableSSLPinning: function (enable, success, failure) {
|
||||
return exec(success, failure, 'CordovaHttpPlugin', 'enableSSLPinning', [enable]);
|
||||
},
|
||||
|
||||
Vendored
+3
@@ -47,6 +47,9 @@ function registerService(http) {
|
||||
clearCookies: function () {
|
||||
return http.clearCookies();
|
||||
},
|
||||
removeCookies: function (url) {
|
||||
return http.removeCookies(url);
|
||||
},
|
||||
enableSSLPinning: function (enable) {
|
||||
return makePromise(http.enableSSLPinning, [enable]);
|
||||
},
|
||||
|
||||
+14
-1
@@ -11,7 +11,8 @@ var cookieJar = new ToughCookie.CookieJar(store);
|
||||
module.exports = {
|
||||
setCookieFromString: setCookieFromString,
|
||||
getCookieString: getCookieString,
|
||||
clearCookies: clearCookies
|
||||
clearCookies: clearCookies,
|
||||
removeCookies: removeCookies
|
||||
}
|
||||
|
||||
function splitCookieString(cookieStr) {
|
||||
@@ -51,3 +52,15 @@ function getCookieString(url) {
|
||||
function clearCookies() {
|
||||
window.localStorage.removeItem(storeKey);
|
||||
}
|
||||
|
||||
function removeCookies(url, cb) {
|
||||
cookieJar.getCookies(url, function(error, cookies) {
|
||||
if (!cookies || cookies.length === 0) {
|
||||
return cb(null, []);
|
||||
}
|
||||
|
||||
var domain = cookies[0].domain;
|
||||
|
||||
cookieJar.store.removeCookies(domain, null, cb);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user