mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2026-05-31 00:00:07 +08:00
implement www interface for #155
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@ module.exports = function init(global, jsUtil, cookieHandler, messages, base64,
|
||||
var validSerializers = ['urlencoded', 'json', 'utf8', 'raw', 'multipart'];
|
||||
var validCertModes = ['default', 'nocheck', 'pinned', 'legacy'];
|
||||
var validClientAuthModes = ['none', 'systemstore', 'buffer'];
|
||||
var validHttpMethods = ['get', 'put', 'post', 'patch', 'head', 'delete', 'upload', 'download'];
|
||||
var validHttpMethods = ['get', 'put', 'post', 'patch', 'head', 'delete', 'options', 'upload', 'download'];
|
||||
var validResponseTypes = ['text', 'json', 'arraybuffer', 'blob'];
|
||||
|
||||
var interface = {
|
||||
|
||||
+10
-5
@@ -22,11 +22,12 @@ module.exports = function init(exec, cookieHandler, urlUtil, helpers, globalConf
|
||||
setClientAuthMode: setClientAuthMode,
|
||||
sendRequest: sendRequest,
|
||||
post: post,
|
||||
get: get,
|
||||
put: put,
|
||||
patch: patch,
|
||||
get: get,
|
||||
delete: del,
|
||||
head: head,
|
||||
options: options,
|
||||
uploadFile: uploadFile,
|
||||
downloadFile: downloadFile,
|
||||
ErrorCode: errorCodes,
|
||||
@@ -172,10 +173,6 @@ module.exports = function init(exec, cookieHandler, urlUtil, helpers, globalConf
|
||||
return publicInterface.sendRequest(url, { method: 'post', data: data, headers: headers }, success, failure);
|
||||
};
|
||||
|
||||
function get(url, params, headers, success, failure) {
|
||||
return publicInterface.sendRequest(url, { method: 'get', params: params, headers: headers }, success, failure);
|
||||
};
|
||||
|
||||
function put(url, data, headers, success, failure) {
|
||||
return publicInterface.sendRequest(url, { method: 'put', data: data, headers: headers }, success, failure);
|
||||
}
|
||||
@@ -184,6 +181,10 @@ module.exports = function init(exec, cookieHandler, urlUtil, helpers, globalConf
|
||||
return publicInterface.sendRequest(url, { method: 'patch', data: data, headers: headers }, success, failure);
|
||||
}
|
||||
|
||||
function get(url, params, headers, success, failure) {
|
||||
return publicInterface.sendRequest(url, { method: 'get', params: params, headers: headers }, success, failure);
|
||||
};
|
||||
|
||||
function del(url, params, headers, success, failure) {
|
||||
return publicInterface.sendRequest(url, { method: 'delete', params: params, headers: headers }, success, failure);
|
||||
}
|
||||
@@ -192,6 +193,10 @@ module.exports = function init(exec, cookieHandler, urlUtil, helpers, globalConf
|
||||
return publicInterface.sendRequest(url, { method: 'head', params: params, headers: headers }, success, failure);
|
||||
}
|
||||
|
||||
function options(url, params, headers, success, failure) {
|
||||
return publicInterface.sendRequest(url, { method: 'options', params: params, headers: headers }, success, failure);
|
||||
};
|
||||
|
||||
function uploadFile(url, params, headers, filePath, name, success, failure) {
|
||||
return publicInterface.sendRequest(url, { method: 'upload', params: params, headers: headers, filePath: filePath, name: name }, success, failure);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user