superagent 10.0.0 → 10.0.1
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/dist/superagent.js +3 -11
- package/dist/superagent.min.js +1 -1
- package/lib/utils.js +3 -12
- package/package.json +3 -5
package/dist/superagent.js
CHANGED
|
@@ -3165,14 +3165,6 @@ ResponseBase.prototype._setStatusProperties = function (status) {
|
|
|
3165
3165
|
};
|
|
3166
3166
|
|
|
3167
3167
|
},{"./utils":36}],36:[function(require,module,exports){
|
|
3168
|
-
let RE2;
|
|
3169
|
-
let hasRE2 = true;
|
|
3170
|
-
try {
|
|
3171
|
-
RE2 = require('re2');
|
|
3172
|
-
} catch {
|
|
3173
|
-
hasRE2 = false;
|
|
3174
|
-
}
|
|
3175
|
-
const SafeRegExp = hasRE2 ? RE2 : RegExp;
|
|
3176
3168
|
exports.type = string_ => string_.split(/ *; */).shift();
|
|
3177
3169
|
exports.params = value => {
|
|
3178
3170
|
const object = {};
|
|
@@ -3222,11 +3214,11 @@ exports.mixin = (target, source) => {
|
|
|
3222
3214
|
}
|
|
3223
3215
|
};
|
|
3224
3216
|
exports.isGzipOrDeflateEncoding = res => {
|
|
3225
|
-
return new
|
|
3217
|
+
return new RegExp(/^\s*(?:deflate|gzip)\s*$/).test(res.headers['content-encoding']);
|
|
3226
3218
|
};
|
|
3227
3219
|
exports.isBrotliEncoding = res => {
|
|
3228
|
-
return new
|
|
3220
|
+
return new RegExp(/^\s*(?:br)\s*$/).test(res.headers['content-encoding']);
|
|
3229
3221
|
};
|
|
3230
3222
|
|
|
3231
|
-
},{
|
|
3223
|
+
},{}]},{},[33])(33)
|
|
3232
3224
|
});
|
package/dist/superagent.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).superagent=t()}}((function(){var t={exports:{}};function e(t){if(t)return function(t){for(var r in e.prototype)t[r]=e.prototype[r];return t}(t)}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,o=this._callbacks["$"+t];if(!o)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i<o.length;i++)if((r=o[i])===e||r.fn===e){o.splice(i,1);break}return 0===o.length&&delete this._callbacks["$"+t],this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],o=1;o<arguments.length;o++)e[o-1]=arguments[o];if(r){o=0;for(var i=(r=r.slice(0)).length;o<i;++o)r[o].apply(this,e)}return this},e.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},e.prototype.hasListeners=function(t){return!!this.listeners(t).length},t=t.exports;var r;r=n,n.default=n,n.stable=h,n.stableStringify=h;var o=[],i=[];function s(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function n(t,e,r,n){var u;void 0===n&&(n=s()),function t(e,r,o,i,s,n,u){var h;if(n+=1,"object"==typeof e&&null!==e){for(h=0;h<i.length;h++)if(i[h]===e)return void a("[Circular]",e,r,s);if(void 0!==u.depthLimit&&n>u.depthLimit)return void a("[...]",e,r,s);if(void 0!==u.edgesLimit&&o+1>u.edgesLimit)return void a("[...]",e,r,s);if(i.push(e),Array.isArray(e))for(h=0;h<e.length;h++)t(e[h],h,h,i,e,n,u);else{var p=Object.keys(e);for(h=0;h<p.length;h++){var l=p[h];t(e[l],l,h,i,e,n,u)}}i.pop()}}(t,"",0,[],void 0,0,n);try{u=0===i.length?JSON.stringify(t,e,r):JSON.stringify(t,p(e),r)}catch(l){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==o.length;){var h=o.pop();4===h.length?Object.defineProperty(h[0],h[1],h[3]):h[0][h[1]]=h[2]}}return u}function a(t,e,r,s){var n=Object.getOwnPropertyDescriptor(s,r);void 0!==n.get?n.configurable?(Object.defineProperty(s,r,{value:t}),o.push([s,r,e,n])):i.push([e,r,t]):(s[r]=t,o.push([s,r,e]))}function u(t,e){return t<e?-1:t>e?1:0}function h(t,e,r,n){void 0===n&&(n=s());var h,l=function t(e,r,i,s,n,h,p){var l;if(h+=1,"object"==typeof e&&null!==e){for(l=0;l<s.length;l++)if(s[l]===e)return void a("[Circular]",e,r,n);try{if("function"==typeof e.toJSON)return}catch(y){return}if(void 0!==p.depthLimit&&h>p.depthLimit)return void a("[...]",e,r,n);if(void 0!==p.edgesLimit&&i+1>p.edgesLimit)return void a("[...]",e,r,n);if(s.push(e),Array.isArray(e))for(l=0;l<e.length;l++)t(e[l],l,l,s,e,h,p);else{var c={},f=Object.keys(e).sort(u);for(l=0;l<f.length;l++){var d=f[l];t(e[d],d,l,s,e,h,p),c[d]=e[d]}if(void 0===n)return c;o.push([n,r,e]),n[r]=c}s.pop()}}(t,"",0,[],void 0,0,n)||t;try{h=0===i.length?JSON.stringify(l,e,r):JSON.stringify(l,p(e),r)}catch(f){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==o.length;){var c=o.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return h}function p(t){return t=void 0!==t?t:function(t,e){return e},function(e,r){if(i.length>0)for(var o=0;o<i.length;o++){var s=i[o];if(s[1]===e&&s[0]===r){r=s[2],i.splice(o,1);break}}return t.call(this,e,r)}}String.prototype.replace;var l=void 0,c={};let f,d=!0;try{f={}}catch{d=!1}d||RegExp;c.type=t=>t.split(/ *; */).shift(),c.params=t=>{const e={};for(const r of t.split(/ *; */)){const t=r.split(/ *= */),o=t.shift(),i=t.shift();o&&i&&(e[o]=i)}return e},c.parseLinks=t=>{const e={};for(const r of t.split(/ *, */)){const t=r.split(/ *; */),o=t[0].slice(1,-1);e[t[1].split(/ *= */)[1].slice(1,-1)]=o}return e},c.isObject=t=>null!==t&&"object"==typeof t,c.hasOwn=Object.hasOwn||function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(new Object(t),e)},c.mixin=(t,e)=>{for(const r in e)c.hasOwn(e,r)&&(t[r]=e[r])};var y;const{isObject:m,hasOwn:_}=c;function b(){}y=b,b.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},b.prototype.parse=function(t){return this._parser=t,this},b.prototype.responseType=function(t){return this._responseType=t,this},b.prototype.serialize=function(t){return this._serializer=t,this},b.prototype.timeout=function(t){if(!t||"object"!=typeof t)return this._timeout=t,this._responseTimeout=0,this._uploadTimeout=0,this;for(const e in t)if(_(t,e))switch(e){case"deadline":this._timeout=t.deadline;break;case"response":this._responseTimeout=t.response;break;case"upload":this._uploadTimeout=t.upload;break;default:console.warn("Unknown timeout option",e)}return this},b.prototype.retry=function(t,e){return 0!==arguments.length&&!0!==t||(t=1),t<=0&&(t=0),this._maxRetries=t,this._retries=0,this._retryCallback=e,this};const w=new Set(["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"]),g=new Set([408,413,429,500,502,503,504,521,522,524]);b.prototype._shouldRetry=function(t,e){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{const r=this._retryCallback(t,e);if(!0===r)return!0;if(!1===r)return!1}catch(r){console.error(r)}if(e&&e.status&&g.has(e.status))return!0;if(t){if(t.code&&w.has(t.code))return!0;if(t.timeout&&"ECONNABORTED"===t.code)return!0;if(t.crossDomain)return!0}return!1},b.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},b.prototype.then=function(t,e){if(!this._fullfilledPromise){const t=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise((e,r)=>{t.on("abort",()=>{if(this._maxRetries&&this._maxRetries>this._retries)return;if(this.timedout&&this.timedoutError)return void r(this.timedoutError);const t=new Error("Aborted");t.code="ABORTED",t.status=this.status,t.method=this.method,t.url=this.url,r(t)}),t.end((t,o)=>{t?r(t):e(o)})})}return this._fullfilledPromise.then(t,e)},b.prototype.catch=function(t){return this.then(void 0,t)},b.prototype.use=function(t){return t(this),this},b.prototype.ok=function(t){if("function"!=typeof t)throw new Error("Callback required");return this._okCallback=t,this},b.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):t.status>=200&&t.status<300)},b.prototype.get=function(t){return this._header[t.toLowerCase()]},b.prototype.getHeader=b.prototype.get,b.prototype.set=function(t,e){if(m(t)){for(const e in t)_(t,e)&&this.set(e,t[e]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},b.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},b.prototype.field=function(t,e,r){if(null==t)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(m(t)){for(const e in t)_(t,e)&&this.field(e,t[e]);return this}if(Array.isArray(e)){for(const r in e)_(e,r)&&this.field(t,e[r]);return this}if(null==e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=String(e)),r?this._getFormData().append(t,e,r):this._getFormData().append(t,e),this},b.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},b.prototype._auth=function(t,e,r,o){switch(r.type){case"basic":this.set("Authorization","Basic "+o(`${t}:${e}`));break;case"auto":this.username=t,this.password=e;break;case"bearer":this.set("Authorization","Bearer "+t)}return this},b.prototype.withCredentials=function(t){return void 0===t&&(t=!0),this._withCredentials=t,this},b.prototype.redirects=function(t){return this._maxRedirects=t,this},b.prototype.maxResponseSize=function(t){if("number"!=typeof t)throw new TypeError("Invalid argument");return this._maxResponseSize=t,this},b.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},b.prototype.send=function(t){const e=m(t);let r=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(e&&m(this._data))for(const o in t){if("bigint"==typeof t[o]&&!t[o].toJSON)throw new Error("Cannot serialize BigInt value to json");_(t,o)&&(this._data[o]=t[o])}else{if("bigint"==typeof t)throw new Error("Cannot send value of type BigInt");"string"==typeof t?(r||this.type("form"),(r=this._header["content-type"])&&(r=r.toLowerCase().trim()),this._data="application/x-www-form-urlencoded"===r?this._data?`${this._data}&${t}`:t:(this._data||"")+t):this._data=t}return!e||this._isHost(t)||r||this.type("json"),this},b.prototype.sortQuery=function(t){return this._sort=void 0===t||t,this},b.prototype._finalizeQueryString=function(){const t=this._query.join("&");if(t&&(this.url+=(this.url.includes("?")?"&":"?")+t),this._query.length=0,this._sort){const t=this.url.indexOf("?");if(t>=0){const e=this.url.slice(t+1).split("&");"function"==typeof this._sort?e.sort(this._sort):e.sort(),this.url=this.url.slice(0,t)+"?"+e.join("&")}}},b.prototype._appendQueryString=()=>{console.warn("Unsupported")},b.prototype._timeoutError=function(t,e,r){if(this._aborted)return;const o=new Error(t+e+"ms exceeded");o.timeout=e,o.code="ECONNABORTED",o.errno=r,this.timedout=!0,this.timedoutError=o,this.abort(),this.callback(o)},b.prototype._setTimeouts=function(){const t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(()=>{t._timeoutError("Timeout of ",t._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(()=>{t._timeoutError("Response timeout of ",t._responseTimeout,"ETIMEDOUT")},this._responseTimeout))};var T;function E(){}T=E,E.prototype.get=function(t){return this.header[t.toLowerCase()]},E.prototype._setHeaderProperties=function(t){const e=t["content-type"]||"";this.type=c.type(e);const r=c.params(e);for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(this[i]=r[i]);this.links={};try{t.link&&(this.links=c.parseLinks(t.link))}catch(o){}},E.prototype._setStatusProperties=function(t){const e=Math.trunc(t/100);this.statusCode=t,this.status=this.statusCode,this.statusType=e,this.info=1===e,this.ok=2===e,this.redirect=3===e,this.clientError=4===e,this.serverError=5===e,this.error=(4===e||5===e)&&this.toError(),this.created=201===t,this.accepted=202===t,this.noContent=204===t,this.badRequest=400===t,this.unauthorized=401===t,this.notAcceptable=406===t,this.forbidden=403===t,this.notFound=404===t,this.unprocessableEntity=422===t};const v=["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"];class x{constructor(){this._defaults=[]}_setDefaults(t){for(const e of this._defaults)t[e.fn](...e.args)}}for(const st of v)x.prototype[st]=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return this._defaults.push({fn:st,args:e}),this};var O=x,k={};let R;"undefined"!=typeof window?R=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),R=this):R=self;const{isObject:C,mixin:q,hasOwn:A}=c;function j(){}const S=k=k=function(t,e){return"function"==typeof e?new k.Request("GET",t).end(e):1===arguments.length?new k.Request("GET",t):new k.Request(t,e)};k.Request=I,S.getXHR=()=>{if(R.XMLHttpRequest)return new R.XMLHttpRequest;throw new Error("Browser-only version of superagent could not find XHR")};const D="".trim?t=>t.trim():t=>t.replace(/(^\s*|\s*$)/g,"");function L(t){if(!C(t))return t;const e=[];for(const r in t)A(t,r)&&N(e,r,t[r]);return e.join("&")}function N(t,e,r){if(void 0!==r)if(null!==r)if(Array.isArray(r))for(const o of r)N(t,e,o);else if(C(r))for(const o in r)A(r,o)&&N(t,`${e}[${o}]`,r[o]);else t.push(encodeURI(e)+"="+encodeURIComponent(r));else t.push(encodeURI(e))}function P(t){const e={},r=t.split("&");let o,i;for(let s=0,n=r.length;s<n;++s)-1===(i=(o=r[s]).indexOf("="))?e[decodeURIComponent(o)]="":e[decodeURIComponent(o.slice(0,i))]=decodeURIComponent(o.slice(i+1));return e}function H(t){return/[/+]json($|[^-\w])/i.test(t)}function U(t){this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;let{status:e}=this.xhr;1223===e&&(e=204),this._setStatusProperties(e),this.headers=function(t){const e=t.split(/\r?\n/),r={};let o,i,s,n;for(let a=0,u=e.length;a<u;++a)-1!==(o=(i=e[a]).indexOf(":"))&&(s=i.slice(0,o).toLowerCase(),n=D(i.slice(o+1)),r[s]=n);return r}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&t._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function I(t,e){const r=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",()=>{let t,e=null,o=null;try{o=new U(r)}catch(i){return(e=new Error("Parser is unable to parse the response")).parse=!0,e.original=i,r.xhr?(e.rawResponse=void 0===r.xhr.responseType?r.xhr.responseText:r.xhr.response,e.status=r.xhr.status?r.xhr.status:null,e.statusCode=e.status):(e.rawResponse=null,e.status=null),r.callback(e)}r.emit("response",o);try{r._isResponseOK(o)||(t=new Error(o.statusText||o.text||"Unsuccessful HTTP response"))}catch(i){t=i}t?(t.original=e,t.response=o,t.status=t.status||o.status,r.callback(t,o)):r.callback(null,o)})}S.serializeObject=L,S.parseString=P,S.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},S.serialize={"application/x-www-form-urlencoded":l,"application/json":r},S.parse={"application/x-www-form-urlencoded":P,"application/json":JSON.parse},q(U.prototype,T.prototype),U.prototype._parseBody=function(t){let e=S.parse[this.type];return this.req._parser?this.req._parser(this,t):(!e&&H(this.type)&&(e=S.parse["application/json"]),e&&t&&(t.length>0||t instanceof Object)?e(t):null)},U.prototype.toError=function(){const{req:t}=this,{method:e}=t,{url:r}=t,o=`cannot ${e} ${r} (${this.status})`,i=new Error(o);return i.status=this.status,i.method=e,i.url=r,i},S.Response=U,t(I.prototype),q(I.prototype,y.prototype),I.prototype.type=function(t){return this.set("Content-Type",S.types[t]||t),this},I.prototype.accept=function(t){return this.set("Accept",S.types[t]||t),this},I.prototype.auth=function(t,e,r){1===arguments.length&&(e=""),"object"==typeof e&&null!==e&&(r=e,e=""),r||(r={type:"function"==typeof btoa?"basic":"auto"});const o=r.encoder?r.encoder:t=>{if("function"==typeof btoa)return btoa(t);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(t,e,r,o)},I.prototype.query=function(t){return"string"!=typeof t&&(t=L(t)),t&&this._query.push(t),this},I.prototype.attach=function(t,e,r){if(e){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(t,e,r||e.name)}return this},I.prototype._getFormData=function(){return this._formData||(this._formData=new R.FormData),this._formData},I.prototype.callback=function(t,e){if(this._shouldRetry(t,e))return this._retry();const r=this._callback;this.clearTimeout(),t&&(this._maxRetries&&(t.retries=this._retries-1),this.emit("error",t)),r(t,e)},I.prototype.crossDomainError=function(){const t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},I.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},I.prototype.ca=I.prototype.agent,I.prototype.buffer=I.prototype.ca,I.prototype.write=()=>{throw new Error("Streaming is not supported in browser version of superagent")},I.prototype.pipe=I.prototype.write,I.prototype._isHost=function(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},I.prototype.end=function(t){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||j,this._finalizeQueryString(),this._end()},I.prototype._setUploadTimeout=function(){const t=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout(()=>{t._timeoutError("Upload timeout of ",t._uploadTimeout,"ETIMEDOUT")},this._uploadTimeout))},I.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));const t=this;this.xhr=S.getXHR();const{xhr:e}=this;let r=this._formData||this._data;this._setTimeouts(),e.addEventListener("readystatechange",()=>{const{readyState:r}=e;if(r>=2&&t._responseTimeoutTimer&&clearTimeout(t._responseTimeoutTimer),4!==r)return;let o;try{o=e.status}catch(i){o=0}if(!o){if(t.timedout||t._aborted)return;return t.crossDomainError()}t.emit("end")});const o=(e,r)=>{r.total>0&&(r.percent=r.loaded/r.total*100,100===r.percent&&clearTimeout(t._uploadTimeoutTimer)),r.direction=e,t.emit("progress",r)};if(this.hasListeners("progress"))try{e.addEventListener("progress",o.bind(null,"download")),e.upload&&e.upload.addEventListener("progress",o.bind(null,"upload"))}catch(i){}e.upload&&this._setUploadTimeout();try{this.username&&this.password?e.open(this.method,this.url,!0,this.username,this.password):e.open(this.method,this.url,!0)}catch(i){return this.callback(i)}if(this._withCredentials&&(e.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof r&&!this._isHost(r)){const t=this._header["content-type"];let e=this._serializer||S.serialize[t?t.split(";")[0]:""];!e&&H(t)&&(e=S.serialize["application/json"]),e&&(r=e(r))}for(const s in this.header)null!==this.header[s]&&A(this.header,s)&&e.setRequestHeader(s,this.header[s]);this._responseType&&(e.responseType=this._responseType),this.emit("request",this),e.send(void 0===r?null:r)},S.agent=()=>new O;for(const st of["GET","POST","OPTIONS","PATCH","PUT","DELETE"])O.prototype[st.toLowerCase()]=function(t,e){const r=new S.Request(st,t);return this._setDefaults(r),e&&r.end(e),r};function z(t,e,r){const o=S("DELETE",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o}O.prototype.del=O.prototype.delete,S.get=(t,e,r)=>{const o=S("GET",t);return"function"==typeof e&&(r=e,e=null),e&&o.query(e),r&&o.end(r),o},S.head=(t,e,r)=>{const o=S("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&o.query(e),r&&o.end(r),o},S.options=(t,e,r)=>{const o=S("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},S.del=z,S.delete=z,S.patch=(t,e,r)=>{const o=S("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},S.post=(t,e,r)=>{const o=S("POST",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},S.put=(t,e,r)=>{const o=S("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o};var M,$=Object.prototype.toString,F=Math.max,B=function(t,e){for(var r=[],o=0;o<t.length;o+=1)r[o]=t[o];for(var i=0;i<e.length;i+=1)r[i+t.length]=e[i];return r},J=Function.prototype.bind||function(t){var e=this;if("function"!=typeof e||"[object Function]"!==$.apply(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r,o=function(t,e){for(var r=[],o=1,i=0;o<t.length;o+=1,i+=1)r[i]=t[o];return r}(arguments),i=F(0,e.length-o.length),s=[],n=0;n<i;n++)s[n]="$"+n;if(r=Function("binder","return function ("+function(t,e){for(var r="",o=0;o<t.length;o+=1)r+=t[o],o+1<t.length&&(r+=",");return r}(s)+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof r){var i=e.apply(this,B(o,arguments));return Object(i)===i?i:this}return e.apply(t,B(o,arguments))})),e.prototype){var a=function(){};a.prototype=e.prototype,r.prototype=new a,a.prototype=null}return r},G=require(17),X=require(30),W=require(12),Q=G("%Function.prototype.apply%"),K=G("%Function.prototype.call%"),V=G("%Reflect.apply%",!0)||J.call(K,Q),Y=require(6),Z=G("%Math.max%");M=function(t){if("function"!=typeof t)throw new W("a function is required");var e=V(J,K,arguments);return X(e,1+Z(0,t.length-(arguments.length-1)),!0)};var tt=function(){return V(J,Q,arguments)};Y?Y(M,"apply",{value:tt}):M.apply=tt;var et=require(17),rt=M(et("String.prototype.indexOf")),ot=function(t,e){var r=et(t,!!e);return"function"==typeof r&&rt(t,".prototype.")>-1?M(r):r},it=("undefined"!=typeof Symbol&&Symbol,Object.prototype.hasOwnProperty,Array.isArray,function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase())}(),require(17));require(24),require(12),it("%WeakMap%",!0),it("%Map%",!0),ot("WeakMap.prototype.get",!0),ot("WeakMap.prototype.set",!0),ot("WeakMap.prototype.has",!0),ot("Map.prototype.get",!0),ot("Map.prototype.set",!0),ot("Map.prototype.has",!0);return k}));
|
|
1
|
+
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).superagent=t()}}((function(){var t={exports:{}};function e(t){if(t)return function(t){for(var r in e.prototype)t[r]=e.prototype[r];return t}(t)}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,o=this._callbacks["$"+t];if(!o)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i<o.length;i++)if((r=o[i])===e||r.fn===e){o.splice(i,1);break}return 0===o.length&&delete this._callbacks["$"+t],this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],o=1;o<arguments.length;o++)e[o-1]=arguments[o];if(r){o=0;for(var i=(r=r.slice(0)).length;o<i;++o)r[o].apply(this,e)}return this},e.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},e.prototype.hasListeners=function(t){return!!this.listeners(t).length},t=t.exports;var r;r=n,n.default=n,n.stable=h,n.stableStringify=h;var o=[],i=[];function s(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function n(t,e,r,n){var u;void 0===n&&(n=s()),function t(e,r,o,i,s,n,u){var h;if(n+=1,"object"==typeof e&&null!==e){for(h=0;h<i.length;h++)if(i[h]===e)return void a("[Circular]",e,r,s);if(void 0!==u.depthLimit&&n>u.depthLimit)return void a("[...]",e,r,s);if(void 0!==u.edgesLimit&&o+1>u.edgesLimit)return void a("[...]",e,r,s);if(i.push(e),Array.isArray(e))for(h=0;h<e.length;h++)t(e[h],h,h,i,e,n,u);else{var p=Object.keys(e);for(h=0;h<p.length;h++){var l=p[h];t(e[l],l,h,i,e,n,u)}}i.pop()}}(t,"",0,[],void 0,0,n);try{u=0===i.length?JSON.stringify(t,e,r):JSON.stringify(t,p(e),r)}catch(l){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==o.length;){var h=o.pop();4===h.length?Object.defineProperty(h[0],h[1],h[3]):h[0][h[1]]=h[2]}}return u}function a(t,e,r,s){var n=Object.getOwnPropertyDescriptor(s,r);void 0!==n.get?n.configurable?(Object.defineProperty(s,r,{value:t}),o.push([s,r,e,n])):i.push([e,r,t]):(s[r]=t,o.push([s,r,e]))}function u(t,e){return t<e?-1:t>e?1:0}function h(t,e,r,n){void 0===n&&(n=s());var h,l=function t(e,r,i,s,n,h,p){var l;if(h+=1,"object"==typeof e&&null!==e){for(l=0;l<s.length;l++)if(s[l]===e)return void a("[Circular]",e,r,n);try{if("function"==typeof e.toJSON)return}catch(y){return}if(void 0!==p.depthLimit&&h>p.depthLimit)return void a("[...]",e,r,n);if(void 0!==p.edgesLimit&&i+1>p.edgesLimit)return void a("[...]",e,r,n);if(s.push(e),Array.isArray(e))for(l=0;l<e.length;l++)t(e[l],l,l,s,e,h,p);else{var c={},f=Object.keys(e).sort(u);for(l=0;l<f.length;l++){var d=f[l];t(e[d],d,l,s,e,h,p),c[d]=e[d]}if(void 0===n)return c;o.push([n,r,e]),n[r]=c}s.pop()}}(t,"",0,[],void 0,0,n)||t;try{h=0===i.length?JSON.stringify(l,e,r):JSON.stringify(l,p(e),r)}catch(f){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==o.length;){var c=o.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return h}function p(t){return t=void 0!==t?t:function(t,e){return e},function(e,r){if(i.length>0)for(var o=0;o<i.length;o++){var s=i[o];if(s[1]===e&&s[0]===r){r=s[2],i.splice(o,1);break}}return t.call(this,e,r)}}String.prototype.replace;var l=void 0,c={type:t=>t.split(/ *; */).shift(),params:t=>{const e={};for(const r of t.split(/ *; */)){const t=r.split(/ *= */),o=t.shift(),i=t.shift();o&&i&&(e[o]=i)}return e},parseLinks:t=>{const e={};for(const r of t.split(/ *, */)){const t=r.split(/ *; */),o=t[0].slice(1,-1);e[t[1].split(/ *= */)[1].slice(1,-1)]=o}return e},isObject:t=>null!==t&&"object"==typeof t};c.hasOwn=Object.hasOwn||function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(new Object(t),e)},c.mixin=(t,e)=>{for(const r in e)c.hasOwn(e,r)&&(t[r]=e[r])};var f;const{isObject:d,hasOwn:y}=c;function m(){}f=m,m.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},m.prototype.parse=function(t){return this._parser=t,this},m.prototype.responseType=function(t){return this._responseType=t,this},m.prototype.serialize=function(t){return this._serializer=t,this},m.prototype.timeout=function(t){if(!t||"object"!=typeof t)return this._timeout=t,this._responseTimeout=0,this._uploadTimeout=0,this;for(const e in t)if(y(t,e))switch(e){case"deadline":this._timeout=t.deadline;break;case"response":this._responseTimeout=t.response;break;case"upload":this._uploadTimeout=t.upload;break;default:console.warn("Unknown timeout option",e)}return this},m.prototype.retry=function(t,e){return 0!==arguments.length&&!0!==t||(t=1),t<=0&&(t=0),this._maxRetries=t,this._retries=0,this._retryCallback=e,this};const _=new Set(["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"]),b=new Set([408,413,429,500,502,503,504,521,522,524]);m.prototype._shouldRetry=function(t,e){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{const r=this._retryCallback(t,e);if(!0===r)return!0;if(!1===r)return!1}catch(r){console.error(r)}if(e&&e.status&&b.has(e.status))return!0;if(t){if(t.code&&_.has(t.code))return!0;if(t.timeout&&"ECONNABORTED"===t.code)return!0;if(t.crossDomain)return!0}return!1},m.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},m.prototype.then=function(t,e){if(!this._fullfilledPromise){const t=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise((e,r)=>{t.on("abort",()=>{if(this._maxRetries&&this._maxRetries>this._retries)return;if(this.timedout&&this.timedoutError)return void r(this.timedoutError);const t=new Error("Aborted");t.code="ABORTED",t.status=this.status,t.method=this.method,t.url=this.url,r(t)}),t.end((t,o)=>{t?r(t):e(o)})})}return this._fullfilledPromise.then(t,e)},m.prototype.catch=function(t){return this.then(void 0,t)},m.prototype.use=function(t){return t(this),this},m.prototype.ok=function(t){if("function"!=typeof t)throw new Error("Callback required");return this._okCallback=t,this},m.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):t.status>=200&&t.status<300)},m.prototype.get=function(t){return this._header[t.toLowerCase()]},m.prototype.getHeader=m.prototype.get,m.prototype.set=function(t,e){if(d(t)){for(const e in t)y(t,e)&&this.set(e,t[e]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},m.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},m.prototype.field=function(t,e,r){if(null==t)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(d(t)){for(const e in t)y(t,e)&&this.field(e,t[e]);return this}if(Array.isArray(e)){for(const r in e)y(e,r)&&this.field(t,e[r]);return this}if(null==e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=String(e)),r?this._getFormData().append(t,e,r):this._getFormData().append(t,e),this},m.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},m.prototype._auth=function(t,e,r,o){switch(r.type){case"basic":this.set("Authorization","Basic "+o(`${t}:${e}`));break;case"auto":this.username=t,this.password=e;break;case"bearer":this.set("Authorization","Bearer "+t)}return this},m.prototype.withCredentials=function(t){return void 0===t&&(t=!0),this._withCredentials=t,this},m.prototype.redirects=function(t){return this._maxRedirects=t,this},m.prototype.maxResponseSize=function(t){if("number"!=typeof t)throw new TypeError("Invalid argument");return this._maxResponseSize=t,this},m.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},m.prototype.send=function(t){const e=d(t);let r=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(e&&d(this._data))for(const o in t){if("bigint"==typeof t[o]&&!t[o].toJSON)throw new Error("Cannot serialize BigInt value to json");y(t,o)&&(this._data[o]=t[o])}else{if("bigint"==typeof t)throw new Error("Cannot send value of type BigInt");"string"==typeof t?(r||this.type("form"),(r=this._header["content-type"])&&(r=r.toLowerCase().trim()),this._data="application/x-www-form-urlencoded"===r?this._data?`${this._data}&${t}`:t:(this._data||"")+t):this._data=t}return!e||this._isHost(t)||r||this.type("json"),this},m.prototype.sortQuery=function(t){return this._sort=void 0===t||t,this},m.prototype._finalizeQueryString=function(){const t=this._query.join("&");if(t&&(this.url+=(this.url.includes("?")?"&":"?")+t),this._query.length=0,this._sort){const t=this.url.indexOf("?");if(t>=0){const e=this.url.slice(t+1).split("&");"function"==typeof this._sort?e.sort(this._sort):e.sort(),this.url=this.url.slice(0,t)+"?"+e.join("&")}}},m.prototype._appendQueryString=()=>{console.warn("Unsupported")},m.prototype._timeoutError=function(t,e,r){if(this._aborted)return;const o=new Error(t+e+"ms exceeded");o.timeout=e,o.code="ECONNABORTED",o.errno=r,this.timedout=!0,this.timedoutError=o,this.abort(),this.callback(o)},m.prototype._setTimeouts=function(){const t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(()=>{t._timeoutError("Timeout of ",t._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(()=>{t._timeoutError("Response timeout of ",t._responseTimeout,"ETIMEDOUT")},this._responseTimeout))};var w;function g(){}w=g,g.prototype.get=function(t){return this.header[t.toLowerCase()]},g.prototype._setHeaderProperties=function(t){const e=t["content-type"]||"";this.type=c.type(e);const r=c.params(e);for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(this[i]=r[i]);this.links={};try{t.link&&(this.links=c.parseLinks(t.link))}catch(o){}},g.prototype._setStatusProperties=function(t){const e=Math.trunc(t/100);this.statusCode=t,this.status=this.statusCode,this.statusType=e,this.info=1===e,this.ok=2===e,this.redirect=3===e,this.clientError=4===e,this.serverError=5===e,this.error=(4===e||5===e)&&this.toError(),this.created=201===t,this.accepted=202===t,this.noContent=204===t,this.badRequest=400===t,this.unauthorized=401===t,this.notAcceptable=406===t,this.forbidden=403===t,this.notFound=404===t,this.unprocessableEntity=422===t};const T=["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"];class v{constructor(){this._defaults=[]}_setDefaults(t){for(const e of this._defaults)t[e.fn](...e.args)}}for(const ot of T)v.prototype[ot]=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return this._defaults.push({fn:ot,args:e}),this};var E=v,x={};let O;"undefined"!=typeof window?O=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),O=this):O=self;const{isObject:k,mixin:C,hasOwn:R}=c;function q(){}const A=x=x=function(t,e){return"function"==typeof e?new x.Request("GET",t).end(e):1===arguments.length?new x.Request("GET",t):new x.Request(t,e)};x.Request=H,A.getXHR=()=>{if(O.XMLHttpRequest)return new O.XMLHttpRequest;throw new Error("Browser-only version of superagent could not find XHR")};const j="".trim?t=>t.trim():t=>t.replace(/(^\s*|\s*$)/g,"");function S(t){if(!k(t))return t;const e=[];for(const r in t)R(t,r)&&D(e,r,t[r]);return e.join("&")}function D(t,e,r){if(void 0!==r)if(null!==r)if(Array.isArray(r))for(const o of r)D(t,e,o);else if(k(r))for(const o in r)R(r,o)&&D(t,`${e}[${o}]`,r[o]);else t.push(encodeURI(e)+"="+encodeURIComponent(r));else t.push(encodeURI(e))}function L(t){const e={},r=t.split("&");let o,i;for(let s=0,n=r.length;s<n;++s)-1===(i=(o=r[s]).indexOf("="))?e[decodeURIComponent(o)]="":e[decodeURIComponent(o.slice(0,i))]=decodeURIComponent(o.slice(i+1));return e}function N(t){return/[/+]json($|[^-\w])/i.test(t)}function P(t){this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;let{status:e}=this.xhr;1223===e&&(e=204),this._setStatusProperties(e),this.headers=function(t){const e=t.split(/\r?\n/),r={};let o,i,s,n;for(let a=0,u=e.length;a<u;++a)-1!==(o=(i=e[a]).indexOf(":"))&&(s=i.slice(0,o).toLowerCase(),n=j(i.slice(o+1)),r[s]=n);return r}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&t._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function H(t,e){const r=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",()=>{let t,e=null,o=null;try{o=new P(r)}catch(i){return(e=new Error("Parser is unable to parse the response")).parse=!0,e.original=i,r.xhr?(e.rawResponse=void 0===r.xhr.responseType?r.xhr.responseText:r.xhr.response,e.status=r.xhr.status?r.xhr.status:null,e.statusCode=e.status):(e.rawResponse=null,e.status=null),r.callback(e)}r.emit("response",o);try{r._isResponseOK(o)||(t=new Error(o.statusText||o.text||"Unsuccessful HTTP response"))}catch(i){t=i}t?(t.original=e,t.response=o,t.status=t.status||o.status,r.callback(t,o)):r.callback(null,o)})}A.serializeObject=S,A.parseString=L,A.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},A.serialize={"application/x-www-form-urlencoded":l,"application/json":r},A.parse={"application/x-www-form-urlencoded":L,"application/json":JSON.parse},C(P.prototype,w.prototype),P.prototype._parseBody=function(t){let e=A.parse[this.type];return this.req._parser?this.req._parser(this,t):(!e&&N(this.type)&&(e=A.parse["application/json"]),e&&t&&(t.length>0||t instanceof Object)?e(t):null)},P.prototype.toError=function(){const{req:t}=this,{method:e}=t,{url:r}=t,o=`cannot ${e} ${r} (${this.status})`,i=new Error(o);return i.status=this.status,i.method=e,i.url=r,i},A.Response=P,t(H.prototype),C(H.prototype,f.prototype),H.prototype.type=function(t){return this.set("Content-Type",A.types[t]||t),this},H.prototype.accept=function(t){return this.set("Accept",A.types[t]||t),this},H.prototype.auth=function(t,e,r){1===arguments.length&&(e=""),"object"==typeof e&&null!==e&&(r=e,e=""),r||(r={type:"function"==typeof btoa?"basic":"auto"});const o=r.encoder?r.encoder:t=>{if("function"==typeof btoa)return btoa(t);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(t,e,r,o)},H.prototype.query=function(t){return"string"!=typeof t&&(t=S(t)),t&&this._query.push(t),this},H.prototype.attach=function(t,e,r){if(e){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(t,e,r||e.name)}return this},H.prototype._getFormData=function(){return this._formData||(this._formData=new O.FormData),this._formData},H.prototype.callback=function(t,e){if(this._shouldRetry(t,e))return this._retry();const r=this._callback;this.clearTimeout(),t&&(this._maxRetries&&(t.retries=this._retries-1),this.emit("error",t)),r(t,e)},H.prototype.crossDomainError=function(){const t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},H.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},H.prototype.ca=H.prototype.agent,H.prototype.buffer=H.prototype.ca,H.prototype.write=()=>{throw new Error("Streaming is not supported in browser version of superagent")},H.prototype.pipe=H.prototype.write,H.prototype._isHost=function(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},H.prototype.end=function(t){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||q,this._finalizeQueryString(),this._end()},H.prototype._setUploadTimeout=function(){const t=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout(()=>{t._timeoutError("Upload timeout of ",t._uploadTimeout,"ETIMEDOUT")},this._uploadTimeout))},H.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));const t=this;this.xhr=A.getXHR();const{xhr:e}=this;let r=this._formData||this._data;this._setTimeouts(),e.addEventListener("readystatechange",()=>{const{readyState:r}=e;if(r>=2&&t._responseTimeoutTimer&&clearTimeout(t._responseTimeoutTimer),4!==r)return;let o;try{o=e.status}catch(i){o=0}if(!o){if(t.timedout||t._aborted)return;return t.crossDomainError()}t.emit("end")});const o=(e,r)=>{r.total>0&&(r.percent=r.loaded/r.total*100,100===r.percent&&clearTimeout(t._uploadTimeoutTimer)),r.direction=e,t.emit("progress",r)};if(this.hasListeners("progress"))try{e.addEventListener("progress",o.bind(null,"download")),e.upload&&e.upload.addEventListener("progress",o.bind(null,"upload"))}catch(i){}e.upload&&this._setUploadTimeout();try{this.username&&this.password?e.open(this.method,this.url,!0,this.username,this.password):e.open(this.method,this.url,!0)}catch(i){return this.callback(i)}if(this._withCredentials&&(e.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof r&&!this._isHost(r)){const t=this._header["content-type"];let e=this._serializer||A.serialize[t?t.split(";")[0]:""];!e&&N(t)&&(e=A.serialize["application/json"]),e&&(r=e(r))}for(const s in this.header)null!==this.header[s]&&R(this.header,s)&&e.setRequestHeader(s,this.header[s]);this._responseType&&(e.responseType=this._responseType),this.emit("request",this),e.send(void 0===r?null:r)},A.agent=()=>new E;for(const ot of["GET","POST","OPTIONS","PATCH","PUT","DELETE"])E.prototype[ot.toLowerCase()]=function(t,e){const r=new A.Request(ot,t);return this._setDefaults(r),e&&r.end(e),r};function U(t,e,r){const o=A("DELETE",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o}E.prototype.del=E.prototype.delete,A.get=(t,e,r)=>{const o=A("GET",t);return"function"==typeof e&&(r=e,e=null),e&&o.query(e),r&&o.end(r),o},A.head=(t,e,r)=>{const o=A("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&o.query(e),r&&o.end(r),o},A.options=(t,e,r)=>{const o=A("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},A.del=U,A.delete=U,A.patch=(t,e,r)=>{const o=A("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},A.post=(t,e,r)=>{const o=A("POST",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},A.put=(t,e,r)=>{const o=A("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o};var I,z=Object.prototype.toString,M=Math.max,$=function(t,e){for(var r=[],o=0;o<t.length;o+=1)r[o]=t[o];for(var i=0;i<e.length;i+=1)r[i+t.length]=e[i];return r},F=Function.prototype.bind||function(t){var e=this;if("function"!=typeof e||"[object Function]"!==z.apply(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r,o=function(t,e){for(var r=[],o=1,i=0;o<t.length;o+=1,i+=1)r[i]=t[o];return r}(arguments),i=M(0,e.length-o.length),s=[],n=0;n<i;n++)s[n]="$"+n;if(r=Function("binder","return function ("+function(t,e){for(var r="",o=0;o<t.length;o+=1)r+=t[o],o+1<t.length&&(r+=",");return r}(s)+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof r){var i=e.apply(this,$(o,arguments));return Object(i)===i?i:this}return e.apply(t,$(o,arguments))})),e.prototype){var a=function(){};a.prototype=e.prototype,r.prototype=new a,a.prototype=null}return r},B=require(17),J=require(30),G=require(12),X=B("%Function.prototype.apply%"),W=B("%Function.prototype.call%"),Q=B("%Reflect.apply%",!0)||F.call(W,X),K=require(6),V=B("%Math.max%");I=function(t){if("function"!=typeof t)throw new G("a function is required");var e=Q(F,W,arguments);return J(e,1+V(0,t.length-(arguments.length-1)),!0)};var Y=function(){return Q(F,X,arguments)};K?K(I,"apply",{value:Y}):I.apply=Y;var Z=require(17),tt=I(Z("String.prototype.indexOf")),et=function(t,e){var r=Z(t,!!e);return"function"==typeof r&&tt(t,".prototype.")>-1?I(r):r},rt=("undefined"!=typeof Symbol&&Symbol,Object.prototype.hasOwnProperty,Array.isArray,function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase())}(),require(17));require(24),require(12),rt("%WeakMap%",!0),rt("%Map%",!0),et("WeakMap.prototype.get",!0),et("WeakMap.prototype.set",!0),et("WeakMap.prototype.has",!0),et("Map.prototype.get",!0),et("Map.prototype.set",!0),et("Map.prototype.has",!0);return x}));
|
package/lib/utils.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
let RE2;
|
|
4
|
-
let hasRE2 = true;
|
|
5
|
-
try {
|
|
6
|
-
RE2 = require('re2');
|
|
7
|
-
} catch {
|
|
8
|
-
hasRE2 = false;
|
|
9
|
-
}
|
|
10
|
-
const SafeRegExp = hasRE2 ? RE2 : RegExp;
|
|
11
|
-
|
|
12
3
|
/**
|
|
13
4
|
* Return the mime type for the given `str`.
|
|
14
5
|
*
|
|
@@ -116,7 +107,7 @@ exports.mixin = (target, source) => {
|
|
|
116
107
|
*/
|
|
117
108
|
|
|
118
109
|
exports.isGzipOrDeflateEncoding = res => {
|
|
119
|
-
return new
|
|
110
|
+
return new RegExp(/^\s*(?:deflate|gzip)\s*$/).test(res.headers['content-encoding']);
|
|
120
111
|
};
|
|
121
112
|
|
|
122
113
|
/**
|
|
@@ -126,6 +117,6 @@ exports.isGzipOrDeflateEncoding = res => {
|
|
|
126
117
|
*/
|
|
127
118
|
|
|
128
119
|
exports.isBrotliEncoding = res => {
|
|
129
|
-
return new
|
|
120
|
+
return new RegExp(/^\s*(?:br)\s*$/).test(res.headers['content-encoding']);
|
|
130
121
|
};
|
|
131
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
122
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJleHBvcnRzIiwidHlwZSIsInN0cmluZ18iLCJzcGxpdCIsInNoaWZ0IiwicGFyYW1zIiwidmFsdWUiLCJvYmplY3QiLCJwYXJ0cyIsImtleSIsInBhcnNlTGlua3MiLCJ1cmwiLCJzbGljZSIsInJlbCIsImNsZWFuSGVhZGVyIiwiaGVhZGVyIiwiY2hhbmdlc09yaWdpbiIsImhvc3QiLCJhdXRob3JpemF0aW9uIiwiY29va2llIiwiaXNPYmplY3QiLCJoYXNPd24iLCJPYmplY3QiLCJwcm9wZXJ0eSIsIlR5cGVFcnJvciIsInByb3RvdHlwZSIsImhhc093blByb3BlcnR5IiwiY2FsbCIsIm1peGluIiwidGFyZ2V0Iiwic291cmNlIiwiaXNHemlwT3JEZWZsYXRlRW5jb2RpbmciLCJyZXMiLCJSZWdFeHAiLCJ0ZXN0IiwiaGVhZGVycyIsImlzQnJvdGxpRW5jb2RpbmciXSwic291cmNlcyI6WyIuLi9zcmMvdXRpbHMuanMiXSwic291cmNlc0NvbnRlbnQiOlsiXG4vKipcbiAqIFJldHVybiB0aGUgbWltZSB0eXBlIGZvciB0aGUgZ2l2ZW4gYHN0cmAuXG4gKlxuICogQHBhcmFtIHtTdHJpbmd9IHN0clxuICogQHJldHVybiB7U3RyaW5nfVxuICogQGFwaSBwcml2YXRlXG4gKi9cblxuZXhwb3J0c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0FBQ0MsSUFBSSxDQUFDRixHQUFHLENBQUNHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQ3JGLENBQUM7O0FBRUQ7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQW5DLE9BQU8sQ0FBQ29DLGdCQUFnQixHQUFJSixHQUFHLElBQUs7RUFDbEMsT0FBTyxJQUFJQyxNQUFNLENBQUMsZ0JBQWdCLENBQUMsQ0FBQ0MsSUFBSSxDQUFDRixHQUFHLENBQUNHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzNFLENBQUMiLCJpZ25vcmVMaXN0IjpbXX0=
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superagent",
|
|
3
3
|
"description": "elegant & feature rich browser / node HTTP with a fluent API",
|
|
4
|
-
"version": "10.0.
|
|
4
|
+
"version": "10.0.1",
|
|
5
5
|
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
|
6
6
|
"browser": {
|
|
7
7
|
"./src/node/index.js": "./src/client.js",
|
|
8
8
|
"./lib/node/index.js": "./lib/client.js",
|
|
9
|
-
"./test/support/server.js": "./test/support/blank.js"
|
|
10
|
-
"re2": false
|
|
9
|
+
"./test/support/server.js": "./test/support/blank.js"
|
|
11
10
|
},
|
|
12
11
|
"bugs": {
|
|
13
12
|
"url": "https://github.com/ladjs/superagent/issues"
|
|
@@ -27,8 +26,7 @@
|
|
|
27
26
|
"formidable": "^3.5.1",
|
|
28
27
|
"methods": "^1.1.2",
|
|
29
28
|
"mime": "2.6.0",
|
|
30
|
-
"qs": "^6.11.0"
|
|
31
|
-
"re2": "^1.21.3"
|
|
29
|
+
"qs": "^6.11.0"
|
|
32
30
|
},
|
|
33
31
|
"devDependencies": {
|
|
34
32
|
"@babel/cli": "^7.20.7",
|