catto.js 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/request.js +12 -2
package/package.json
CHANGED
package/request.js
CHANGED
|
@@ -20,7 +20,7 @@ function wrap(method, options) {
|
|
|
20
20
|
var options2 = Object.assign({}, options);
|
|
21
21
|
var url = options2.url;
|
|
22
22
|
delete options2.url;
|
|
23
|
-
options2.method = method;
|
|
23
|
+
options2.method = method.toUpperCase();
|
|
24
24
|
return new Promise((res, rej) => {
|
|
25
25
|
fetch(url, options2).then(response => {
|
|
26
26
|
response.text().then(body => {
|
|
@@ -71,6 +71,16 @@ function put(options) {
|
|
|
71
71
|
return wrap("put", options);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
/**
|
|
75
|
+
* DELETE request.
|
|
76
|
+
* @param {object} options
|
|
77
|
+
* @return {promise}
|
|
78
|
+
*/
|
|
79
|
+
function _delete(options) {
|
|
80
|
+
return wrap("delete", options);
|
|
81
|
+
}
|
|
82
|
+
|
|
74
83
|
module.exports = {
|
|
75
|
-
get, post, patch, put
|
|
84
|
+
get, post, patch, put,
|
|
85
|
+
"delete": _delete
|
|
76
86
|
};
|