superagent 3.8.2 → 3.8.3
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/History.md +13 -0
- package/Readme.md +1 -0
- package/docs/index.md +109 -59
- package/lib/client.js +2 -2
- package/lib/node/index.js +58 -23
- package/lib/request-base.js +1 -1
- package/lib/response-base.js +2 -0
- package/package.json +5 -5
- package/superagent.js +7 -5
- package/test.js +7 -0
- package/yarn.lock +330 -504
package/superagent.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.superagent = f()}})(function(){var define,module,exports;return (function e
|
|
1
|
+
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.superagent = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
2
2
|
function Agent() {
|
|
3
3
|
this._defaults = [];
|
|
4
4
|
}
|
|
@@ -284,7 +284,7 @@ RequestBase.prototype.then = function then(resolve, reject) {
|
|
|
284
284
|
return this._fullfilledPromise.then(resolve, reject);
|
|
285
285
|
};
|
|
286
286
|
|
|
287
|
-
RequestBase.prototype
|
|
287
|
+
RequestBase.prototype['catch'] = function(cb) {
|
|
288
288
|
return this.then(undefined, cb);
|
|
289
289
|
};
|
|
290
290
|
|
|
@@ -860,6 +860,7 @@ ResponseBase.prototype._setStatusProperties = function(status){
|
|
|
860
860
|
: false;
|
|
861
861
|
|
|
862
862
|
// sugar
|
|
863
|
+
this.created = 201 == status;
|
|
863
864
|
this.accepted = 202 == status;
|
|
864
865
|
this.noContent = 204 == status;
|
|
865
866
|
this.badRequest = 400 == status;
|
|
@@ -867,6 +868,7 @@ ResponseBase.prototype._setStatusProperties = function(status){
|
|
|
867
868
|
this.notAcceptable = 406 == status;
|
|
868
869
|
this.forbidden = 403 == status;
|
|
869
870
|
this.notFound = 404 == status;
|
|
871
|
+
this.unprocessableEntity = 422 == status;
|
|
870
872
|
};
|
|
871
873
|
|
|
872
874
|
},{"./utils":5}],5:[function(require,module,exports){
|
|
@@ -1296,7 +1298,7 @@ request.types = {
|
|
|
1296
1298
|
|
|
1297
1299
|
request.serialize = {
|
|
1298
1300
|
'application/x-www-form-urlencoded': serialize,
|
|
1299
|
-
'application/json': JSON.stringify
|
|
1301
|
+
'application/json': JSON.stringify
|
|
1300
1302
|
};
|
|
1301
1303
|
|
|
1302
1304
|
/**
|
|
@@ -1310,7 +1312,7 @@ request.serialize = {
|
|
|
1310
1312
|
|
|
1311
1313
|
request.parse = {
|
|
1312
1314
|
'application/x-www-form-urlencoded': parseString,
|
|
1313
|
-
'application/json': JSON.parse
|
|
1315
|
+
'application/json': JSON.parse
|
|
1314
1316
|
};
|
|
1315
1317
|
|
|
1316
1318
|
/**
|
|
@@ -2030,4 +2032,4 @@ request.put = function(url, data, fn) {
|
|
|
2030
2032
|
};
|
|
2031
2033
|
|
|
2032
2034
|
},{"./agent-base":1,"./is-object":2,"./request-base":3,"./response-base":4,"component-emitter":6}]},{},[7])(7)
|
|
2033
|
-
});
|
|
2035
|
+
});
|