0% found this document useful (0 votes)
16 views14 pages

Return HIt

The document outlines the structure and functionality of a JavaScript library, specifically focusing on Axios version 1.5.1. It details the handling of options, request and response interceptors, and HTTP status codes, along with methods for making HTTP requests. Additionally, it includes error handling and configuration merging capabilities.

Uploaded by

Rivail Silva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views14 pages

Return HIt

The document outlines the structure and functionality of a JavaScript library, specifically focusing on Axios version 1.5.1. It details the handling of options, request and response interceptors, and HTTP status codes, along with methods for making HTTP requests. Additionally, it includes error handling and configuration merging capabilities.

Uploaded by

Rivail Silva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

};

return Ht.forEach(Object.keys(Object.assign({}, e, t)), (function(r) {

var i = l[r] || o

, a = i(e[r], t[r], r);

Ht.isUndefined(a) && i !== s || (n[r] = a)

)),

var Fn = "1.5.1"

, Un = {};

["object", "boolean", "number", "function", "string",


"symbol"].forEach((function(e, t) {

Un[e] = function(n) {

return typeof n === e || "a" + (t < 1 ? "n " : " ") + e

));

var Zn = {};

Un.transitional = function(e, t, n) {

function r(e, t) {

return "[Axios v1.5.1] Transitional option '" + e + "'" + t + (n ? ". " + n : "")

return function(n, o, i) {

if (!1 === e)

throw new Qt(r(o, " has been removed" + (t ? " in " + t :


"")),Qt.ERR_DEPRECATED);

return t && !Zn[o] && (Zn[o] = !0,


console.warn(r(o, " has been deprecated since v" + t + " and will be removed
in the near future"))),

!e || e(n, o, i)

var zn = {

assertOptions: function(e, t, n) {

if ("object" !== typeof e)

throw new Qt("options must be an object",Qt.ERR_BAD_OPTION_VALUE);

for (var r = Object.keys(e), o = r.length; o-- > 0; ) {

var i = r[o]

, a = t[i];

if (a) {

var s = e[i]

, l = void 0 === s || a(s, i, e);

if (!0 !== l)

throw new Qt("option " + i + " must be " +


l,Qt.ERR_BAD_OPTION_VALUE)

} else if (!0 !== n)

throw new Qt("Unknown option " + i,Qt.ERR_BAD_OPTION)

},

validators: Un

, Bn = zn.validators

, qn = function() {

function e(t) {

_(this, e),
this.defaults = t,

this.interceptors = {

request: new sn,

response: new sn

return S(e, [{

key: "request",

value: function(e, t) {

"string" === typeof e ? (t = t || {}).url = e : t = e || {};

var n = t = Dn(this.defaults, t)

, r = n.transitional

, o = n.paramsSerializer

, i = n.headers;

void 0 !== r && zn.assertOptions(r, {

silentJSONParsing: Bn.transitional(Bn.boolean),

forcedJSONParsing: Bn.transitional(Bn.boolean),

clarifyTimeoutError: Bn.transitional(Bn.boolean)

}, !1),

null != o && (Ht.isFunction(o) ? t.paramsSerializer = {

serialize: o

} : zn.assertOptions(o, {

encode: Bn.function,

serialize: Bn.function

}, !0)),

t.method = (t.method || this.defaults.method || "get").toLowerCase();

var a = i && Ht.merge(i.common, i[t.method]);


i && Ht.forEach(["delete", "get", "head", "post", "put", "patch", "common"],
(function(e) {

delete i[e]

)),

t.headers = bn.concat(a, i);

var s = []

, l = !0;

this.interceptors.request.forEach((function(e) {

"function" === typeof e.runWhen && !1 === e.runWhen(t) || (l = l &&


e.synchronous,

s.unshift(e.fulfilled, e.rejected))

));

var u, c = [];

this.interceptors.response.forEach((function(e) {

c.push(e.fulfilled, e.rejected)

));

var d, f = 0;

if (!l) {

var p = [Ln.bind(this), void 0];

for (p.unshift.apply(p, s),

p.push.apply(p, c),

d = p.length,

u = Promise.resolve(t); f < d; )

u = u.then(p[f++], p[f++]);

return u

}
d = s.length;

var h = t;

for (f = 0; f < d; ) {

var m = s[f++]

, v = s[f++];

try {

h = m(h)

} catch (g) {

v.call(this, g);

break

try {

u = Ln.call(this, h)

} catch (g) {

return Promise.reject(g)

for (f = 0,

d = c.length; f < d; )

u = u.then(c[f++], c[f++]);

return u

}, {

key: "getUri",

value: function(e) {

return an(kn((e = Dn(this.defaults, e)).baseURL, e.url), e.params,


e.paramsSerializer)

}
}]),

}();

Ht.forEach(["delete", "get", "head", "options"], (function(e) {

qn.prototype[e] = function(t, n) {

return this.request(Dn(n || {}, {

method: e,

url: t,

data: (n || {}).data

}))

)),

Ht.forEach(["post", "put", "patch"], (function(e) {

function t(t) {

return function(n, r, o) {

return this.request(Dn(o || {}, {

method: e,

headers: t ? {

"Content-Type": "multipart/form-data"

} : {},

url: n,

data: r

}))

qn.prototype[e] = t(),

qn.prototype[e + "Form"] = t(!0)


}

));

var Hn = qn

, Vn = function() {

function e(t) {

if (_(this, e),

"function" !== typeof t)

throw new TypeError("executor must be a function.");

var n;

this.promise = new Promise((function(e) {

n=e

));

var r = this;

this.promise.then((function(e) {

if (r._listeners) {

for (var t = r._listeners.length; t-- > 0; )

r._listeners[t](e);

r._listeners = null

)),

this.promise.then = function(e) {

var t, n = new Promise((function(e) {

r.subscribe(e),

t=e

)).then(e);
return n.cancel = function() {

r.unsubscribe(t)

t((function(e, t, o) {

r.reason || (r.reason = new En(e,t,o),

n(r.reason))

))

return S(e, [{

key: "throwIfRequested",

value: function() {

if (this.reason)

throw this.reason

}, {

key: "subscribe",

value: function(e) {

this.reason ? e(this.reason) : this._listeners ? this._listeners.push(e) :


this._listeners = [e]

}, {

key: "unsubscribe",

value: function(e) {
if (this._listeners) {

var t = this._listeners.indexOf(e);

-1 !== t && this._listeners.splice(t, 1)

}], [{

key: "source",

value: function() {

var t;

return {

token: new e((function(e) {

t=e

)),

cancel: t

}]),

}()

, Wn = Vn;

var Gn = {

Continue: 100,

SwitchingProtocols: 101,

Processing: 102,

EarlyHints: 103,

Ok: 200,

Created: 201,
Accepted: 202,

NonAuthoritativeInformation: 203,

NoContent: 204,

ResetContent: 205,

PartialContent: 206,

MultiStatus: 207,

AlreadyReported: 208,

ImUsed: 226,

MultipleChoices: 300,

MovedPermanently: 301,

Found: 302,

SeeOther: 303,

NotModified: 304,

UseProxy: 305,

Unused: 306,

TemporaryRedirect: 307,

PermanentRedirect: 308,

BadRequest: 400,

Unauthorized: 401,

PaymentRequired: 402,

Forbidden: 403,

NotFound: 404,

MethodNotAllowed: 405,

NotAcceptable: 406,

ProxyAuthenticationRequired: 407,

RequestTimeout: 408,

Conflict: 409,

Gone: 410,
LengthRequired: 411,

PreconditionFailed: 412,

PayloadTooLarge: 413,

UriTooLong: 414,

UnsupportedMediaType: 415,

RangeNotSatisfiable: 416,

ExpectationFailed: 417,

ImATeapot: 418,

MisdirectedRequest: 421,

UnprocessableEntity: 422,

Locked: 423,

FailedDependency: 424,

TooEarly: 425,

UpgradeRequired: 426,

PreconditionRequired: 428,

TooManyRequests: 429,

RequestHeaderFieldsTooLarge: 431,

UnavailableForLegalReasons: 451,

InternalServerError: 500,

NotImplemented: 501,

BadGateway: 502,

ServiceUnavailable: 503,

GatewayTimeout: 504,

HttpVersionNotSupported: 505,

VariantAlsoNegotiates: 506,

InsufficientStorage: 507,

LoopDetected: 508,

NotExtended: 510,
NetworkAuthenticationRequired: 511

};

Object.entries(Gn).forEach((function(e) {

var t = (0,

g.Z)(e, 2)

, n = t[0]

, r = t[1];

Gn[r] = n

));

var Qn = Gn;

var Kn = function e(t) {

var n = new Hn(t)

, r = ct(Hn.prototype.request, n);

return Ht.extend(r, Hn.prototype, n, {

allOwnKeys: !0

}),

Ht.extend(r, n, null, {

allOwnKeys: !0

}),

r.create = function(n) {

return e(Dn(t, n))

}(fn);

Kn.Axios = Hn,

Kn.CanceledError = En,
Kn.CancelToken = Wn,

Kn.isCancel = _n,

Kn.VERSION = Fn,

Kn.toFormData = $t,

Kn.AxiosError = Qt,

Kn.Cancel = Kn.CanceledError,

Kn.all = function(e) {

return Promise.all(e)

Kn.spread = function(e) {

return function(t) {

return e.apply(null, t)

Kn.isAxiosError = function(e) {

return Ht.isObject(e) && !0 === e.isAxiosError

Kn.mergeConfig = Dn,

Kn.AxiosHeaders = bn,

Kn.formToJSON = function(e) {

return cn(Ht.isHTMLForm(e) ? new FormData(e) : e)

Kn.getAdapter = In,

Kn.HttpStatusCode = Qn,
Kn.default = Kn;

var Yn = Kn

You might also like