@nocobase/plugin-ai-gigachat 2.2.19 → 2.2.21

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.
Files changed (88) hide show
  1. package/dist/externalVersion.js +5 -5
  2. package/dist/node_modules/gigachat/package.json +1 -1
  3. package/dist/node_modules/langchain-gigachat/index.cjs +2 -2
  4. package/dist/node_modules/langchain-gigachat/package.json +1 -1
  5. package/package.json +2 -2
  6. package/dist/node_modules/gigachat/node_modules/axios/dist/axios.js +0 -5249
  7. package/dist/node_modules/gigachat/node_modules/axios/dist/axios.min.js +0 -5
  8. package/dist/node_modules/gigachat/node_modules/axios/dist/browser/axios.cjs +0 -5146
  9. package/dist/node_modules/gigachat/node_modules/axios/dist/esm/axios.js +0 -5167
  10. package/dist/node_modules/gigachat/node_modules/axios/dist/esm/axios.min.js +0 -3
  11. package/dist/node_modules/gigachat/node_modules/axios/dist/node/axios.cjs +0 -5996
  12. package/dist/node_modules/gigachat/node_modules/axios/index.d.cts +0 -738
  13. package/dist/node_modules/gigachat/node_modules/axios/index.d.ts +0 -755
  14. package/dist/node_modules/gigachat/node_modules/axios/index.js +0 -45
  15. package/dist/node_modules/gigachat/node_modules/axios/lib/adapters/adapters.js +0 -132
  16. package/dist/node_modules/gigachat/node_modules/axios/lib/adapters/fetch.js +0 -643
  17. package/dist/node_modules/gigachat/node_modules/axios/lib/adapters/http.js +0 -1417
  18. package/dist/node_modules/gigachat/node_modules/axios/lib/adapters/xhr.js +0 -228
  19. package/dist/node_modules/gigachat/node_modules/axios/lib/axios.js +0 -89
  20. package/dist/node_modules/gigachat/node_modules/axios/lib/cancel/CancelToken.js +0 -135
  21. package/dist/node_modules/gigachat/node_modules/axios/lib/cancel/CanceledError.js +0 -22
  22. package/dist/node_modules/gigachat/node_modules/axios/lib/cancel/isCancel.js +0 -5
  23. package/dist/node_modules/gigachat/node_modules/axios/lib/core/Axios.js +0 -283
  24. package/dist/node_modules/gigachat/node_modules/axios/lib/core/AxiosError.js +0 -188
  25. package/dist/node_modules/gigachat/node_modules/axios/lib/core/AxiosHeaders.js +0 -351
  26. package/dist/node_modules/gigachat/node_modules/axios/lib/core/InterceptorManager.js +0 -72
  27. package/dist/node_modules/gigachat/node_modules/axios/lib/core/buildFullPath.js +0 -50
  28. package/dist/node_modules/gigachat/node_modules/axios/lib/core/dispatchRequest.js +0 -89
  29. package/dist/node_modules/gigachat/node_modules/axios/lib/core/mergeConfig.js +0 -159
  30. package/dist/node_modules/gigachat/node_modules/axios/lib/core/settle.js +0 -27
  31. package/dist/node_modules/gigachat/node_modules/axios/lib/core/transformData.js +0 -28
  32. package/dist/node_modules/gigachat/node_modules/axios/lib/defaults/index.js +0 -177
  33. package/dist/node_modules/gigachat/node_modules/axios/lib/defaults/transitional.js +0 -10
  34. package/dist/node_modules/gigachat/node_modules/axios/lib/env/classes/FormData.js +0 -2
  35. package/dist/node_modules/gigachat/node_modules/axios/lib/env/data.js +0 -1
  36. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/AxiosTransformStream.js +0 -156
  37. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -59
  38. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/Http2Sessions.js +0 -119
  39. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -77
  40. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +0 -29
  41. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/bind.js +0 -14
  42. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/buildURL.js +0 -69
  43. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/callbackify.js +0 -18
  44. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/combineURLs.js +0 -15
  45. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/composeSignals.js +0 -57
  46. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/cookies.js +0 -64
  47. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -31
  48. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +0 -105
  49. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/formDataToJSON.js +0 -119
  50. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/formDataToStream.js +0 -119
  51. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/fromDataURI.js +0 -68
  52. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -19
  53. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
  54. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -16
  55. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/null.js +0 -2
  56. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/parseHeaders.js +0 -69
  57. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
  58. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/progressEventReducer.js +0 -54
  59. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/readBlob.js +0 -15
  60. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/resolveConfig.js +0 -119
  61. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +0 -60
  62. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/shouldBypassProxy.js +0 -210
  63. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/speedometer.js +0 -55
  64. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/spread.js +0 -28
  65. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/throttle.js +0 -44
  66. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/toFormData.js +0 -285
  67. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -19
  68. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/trackStream.js +0 -89
  69. package/dist/node_modules/gigachat/node_modules/axios/lib/helpers/validator.js +0 -112
  70. package/dist/node_modules/gigachat/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -3
  71. package/dist/node_modules/gigachat/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -3
  72. package/dist/node_modules/gigachat/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -4
  73. package/dist/node_modules/gigachat/node_modules/axios/lib/platform/browser/index.js +0 -13
  74. package/dist/node_modules/gigachat/node_modules/axios/lib/platform/common/utils.js +0 -52
  75. package/dist/node_modules/gigachat/node_modules/axios/lib/platform/index.js +0 -7
  76. package/dist/node_modules/gigachat/node_modules/axios/lib/platform/node/classes/FormData.js +0 -3
  77. package/dist/node_modules/gigachat/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +0 -4
  78. package/dist/node_modules/gigachat/node_modules/axios/lib/platform/node/index.js +0 -37
  79. package/dist/node_modules/gigachat/node_modules/axios/lib/utils.js +0 -1017
  80. package/dist/node_modules/gigachat/node_modules/axios/package.json +0 -201
  81. package/dist/node_modules/gigachat/node_modules/follow-redirects/debug.js +0 -15
  82. package/dist/node_modules/gigachat/node_modules/follow-redirects/http.js +0 -1
  83. package/dist/node_modules/gigachat/node_modules/follow-redirects/https.js +0 -1
  84. package/dist/node_modules/gigachat/node_modules/follow-redirects/index.js +0 -709
  85. package/dist/node_modules/gigachat/node_modules/follow-redirects/package.json +0 -58
  86. package/dist/node_modules/gigachat/node_modules/proxy-from-env/index.cjs +0 -105
  87. package/dist/node_modules/gigachat/node_modules/proxy-from-env/index.js +0 -103
  88. package/dist/node_modules/gigachat/node_modules/proxy-from-env/package.json +0 -43
@@ -1,351 +0,0 @@
1
- 'use strict';
2
-
3
- import utils from '../utils.js';
4
- import parseHeaders from '../helpers/parseHeaders.js';
5
- import { sanitizeHeaderValue } from '../helpers/sanitizeHeaderValue.js';
6
-
7
- const $internals = Symbol('internals');
8
-
9
- function normalizeHeader(header) {
10
- return header && String(header).trim().toLowerCase();
11
- }
12
-
13
- function normalizeValue(value) {
14
- if (value === false || value == null) {
15
- return value;
16
- }
17
-
18
- return utils.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
19
- }
20
-
21
- function parseTokens(str) {
22
- const tokens = Object.create(null);
23
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
24
- let match;
25
-
26
- while ((match = tokensRE.exec(str))) {
27
- tokens[match[1]] = match[2];
28
- }
29
-
30
- return tokens;
31
- }
32
-
33
- const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
34
-
35
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
36
- if (utils.isFunction(filter)) {
37
- return filter.call(this, value, header);
38
- }
39
-
40
- if (isHeaderNameFilter) {
41
- value = header;
42
- }
43
-
44
- if (!utils.isString(value)) return;
45
-
46
- if (utils.isString(filter)) {
47
- return value.indexOf(filter) !== -1;
48
- }
49
-
50
- if (utils.isRegExp(filter)) {
51
- return filter.test(value);
52
- }
53
- }
54
-
55
- function formatHeader(header) {
56
- return header
57
- .trim()
58
- .toLowerCase()
59
- .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
60
- return char.toUpperCase() + str;
61
- });
62
- }
63
-
64
- function buildAccessors(obj, header) {
65
- const accessorName = utils.toCamelCase(' ' + header);
66
-
67
- ['get', 'set', 'has'].forEach((methodName) => {
68
- Object.defineProperty(obj, methodName + accessorName, {
69
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
70
- // this data descriptor into an accessor descriptor on the way in.
71
- __proto__: null,
72
- value: function (arg1, arg2, arg3) {
73
- return this[methodName].call(this, header, arg1, arg2, arg3);
74
- },
75
- configurable: true,
76
- });
77
- });
78
- }
79
-
80
- class AxiosHeaders {
81
- constructor(headers) {
82
- headers && this.set(headers);
83
- }
84
-
85
- set(header, valueOrRewrite, rewrite) {
86
- const self = this;
87
-
88
- function setHeader(_value, _header, _rewrite) {
89
- const lHeader = normalizeHeader(_header);
90
-
91
- if (!lHeader) {
92
- return;
93
- }
94
-
95
- const key = utils.findKey(self, lHeader);
96
-
97
- if (
98
- !key ||
99
- self[key] === undefined ||
100
- _rewrite === true ||
101
- (_rewrite === undefined && self[key] !== false)
102
- ) {
103
- self[key || _header] = normalizeValue(_value);
104
- }
105
- }
106
-
107
- const setHeaders = (headers, _rewrite) =>
108
- utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
109
-
110
- if (utils.isPlainObject(header) || header instanceof this.constructor) {
111
- setHeaders(header, valueOrRewrite);
112
- } else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
113
- setHeaders(parseHeaders(header), valueOrRewrite);
114
- } else if (utils.isObject(header) && utils.isSafeIterable(header)) {
115
- let obj = Object.create(null),
116
- dest,
117
- key;
118
- for (const entry of header) {
119
- if (!utils.isArray(entry)) {
120
- throw new TypeError('Object iterator must return a key-value pair');
121
- }
122
-
123
- key = entry[0];
124
-
125
- if (utils.hasOwnProp(obj, key)) {
126
- dest = obj[key];
127
- obj[key] = utils.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
128
- } else {
129
- obj[key] = entry[1];
130
- }
131
- }
132
-
133
- setHeaders(obj, valueOrRewrite);
134
- } else {
135
- header != null && setHeader(valueOrRewrite, header, rewrite);
136
- }
137
-
138
- return this;
139
- }
140
-
141
- get(header, parser) {
142
- header = normalizeHeader(header);
143
-
144
- if (header) {
145
- const key = utils.findKey(this, header);
146
-
147
- if (key) {
148
- const value = this[key];
149
-
150
- if (!parser) {
151
- return value;
152
- }
153
-
154
- if (parser === true) {
155
- return parseTokens(value);
156
- }
157
-
158
- if (utils.isFunction(parser)) {
159
- return parser.call(this, value, key);
160
- }
161
-
162
- if (utils.isRegExp(parser)) {
163
- return parser.exec(value);
164
- }
165
-
166
- throw new TypeError('parser must be boolean|regexp|function');
167
- }
168
- }
169
- }
170
-
171
- has(header, matcher) {
172
- header = normalizeHeader(header);
173
-
174
- if (header) {
175
- const key = utils.findKey(this, header);
176
-
177
- return !!(
178
- key &&
179
- this[key] !== undefined &&
180
- (!matcher || matchHeaderValue(this, this[key], key, matcher))
181
- );
182
- }
183
-
184
- return false;
185
- }
186
-
187
- delete(header, matcher) {
188
- const self = this;
189
- let deleted = false;
190
-
191
- function deleteHeader(_header) {
192
- _header = normalizeHeader(_header);
193
-
194
- if (_header) {
195
- const key = utils.findKey(self, _header);
196
-
197
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
198
- delete self[key];
199
-
200
- deleted = true;
201
- }
202
- }
203
- }
204
-
205
- if (utils.isArray(header)) {
206
- header.forEach(deleteHeader);
207
- } else {
208
- deleteHeader(header);
209
- }
210
-
211
- return deleted;
212
- }
213
-
214
- clear(matcher) {
215
- const keys = Object.keys(this);
216
- let i = keys.length;
217
- let deleted = false;
218
-
219
- while (i--) {
220
- const key = keys[i];
221
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
222
- delete this[key];
223
- deleted = true;
224
- }
225
- }
226
-
227
- return deleted;
228
- }
229
-
230
- normalize(format) {
231
- const self = this;
232
- const headers = {};
233
-
234
- utils.forEach(this, (value, header) => {
235
- const key = utils.findKey(headers, header);
236
-
237
- if (key) {
238
- self[key] = normalizeValue(value);
239
- delete self[header];
240
- return;
241
- }
242
-
243
- const normalized = format ? formatHeader(header) : String(header).trim();
244
-
245
- if (normalized !== header) {
246
- delete self[header];
247
- }
248
-
249
- self[normalized] = normalizeValue(value);
250
-
251
- headers[normalized] = true;
252
- });
253
-
254
- return this;
255
- }
256
-
257
- concat(...targets) {
258
- return this.constructor.concat(this, ...targets);
259
- }
260
-
261
- toJSON(asStrings) {
262
- const obj = Object.create(null);
263
-
264
- utils.forEach(this, (value, header) => {
265
- value != null &&
266
- value !== false &&
267
- (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
268
- });
269
-
270
- return obj;
271
- }
272
-
273
- [Symbol.iterator]() {
274
- return Object.entries(this.toJSON())[Symbol.iterator]();
275
- }
276
-
277
- toString() {
278
- return Object.entries(this.toJSON())
279
- .map(([header, value]) => header + ': ' + value)
280
- .join('\n');
281
- }
282
-
283
- getSetCookie() {
284
- return this.get('set-cookie') || [];
285
- }
286
-
287
- get [Symbol.toStringTag]() {
288
- return 'AxiosHeaders';
289
- }
290
-
291
- static from(thing) {
292
- return thing instanceof this ? thing : new this(thing);
293
- }
294
-
295
- static concat(first, ...targets) {
296
- const computed = new this(first);
297
-
298
- targets.forEach((target) => computed.set(target));
299
-
300
- return computed;
301
- }
302
-
303
- static accessor(header) {
304
- const internals =
305
- (this[$internals] =
306
- this[$internals] =
307
- {
308
- accessors: {},
309
- });
310
-
311
- const accessors = internals.accessors;
312
- const prototype = this.prototype;
313
-
314
- function defineAccessor(_header) {
315
- const lHeader = normalizeHeader(_header);
316
-
317
- if (!accessors[lHeader]) {
318
- buildAccessors(prototype, _header);
319
- accessors[lHeader] = true;
320
- }
321
- }
322
-
323
- utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
324
-
325
- return this;
326
- }
327
- }
328
-
329
- AxiosHeaders.accessor([
330
- 'Content-Type',
331
- 'Content-Length',
332
- 'Accept',
333
- 'Accept-Encoding',
334
- 'User-Agent',
335
- 'Authorization',
336
- ]);
337
-
338
- // reserved names hotfix
339
- utils.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
340
- let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
341
- return {
342
- get: () => value,
343
- set(headerValue) {
344
- this[mapped] = headerValue;
345
- },
346
- };
347
- });
348
-
349
- utils.freezeMethods(AxiosHeaders);
350
-
351
- export default AxiosHeaders;
@@ -1,72 +0,0 @@
1
- 'use strict';
2
-
3
- import utils from '../utils.js';
4
-
5
- class InterceptorManager {
6
- constructor() {
7
- this.handlers = [];
8
- }
9
-
10
- /**
11
- * Add a new interceptor to the stack
12
- *
13
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
14
- * @param {Function} rejected The function to handle `reject` for a `Promise`
15
- * @param {Object} options The options for the interceptor, synchronous and runWhen
16
- *
17
- * @return {Number} An ID used to remove interceptor later
18
- */
19
- use(fulfilled, rejected, options) {
20
- this.handlers.push({
21
- fulfilled,
22
- rejected,
23
- synchronous: options ? options.synchronous : false,
24
- runWhen: options ? options.runWhen : null,
25
- });
26
- return this.handlers.length - 1;
27
- }
28
-
29
- /**
30
- * Remove an interceptor from the stack
31
- *
32
- * @param {Number} id The ID that was returned by `use`
33
- *
34
- * @returns {void}
35
- */
36
- eject(id) {
37
- if (this.handlers[id]) {
38
- this.handlers[id] = null;
39
- }
40
- }
41
-
42
- /**
43
- * Clear all interceptors from the stack
44
- *
45
- * @returns {void}
46
- */
47
- clear() {
48
- if (this.handlers) {
49
- this.handlers = [];
50
- }
51
- }
52
-
53
- /**
54
- * Iterate over all the registered interceptors
55
- *
56
- * This method is particularly useful for skipping over any
57
- * interceptors that may have become `null` calling `eject`.
58
- *
59
- * @param {Function} fn The function to call for each interceptor
60
- *
61
- * @returns {void}
62
- */
63
- forEach(fn) {
64
- utils.forEach(this.handlers, function forEachHandler(h) {
65
- if (h !== null) {
66
- fn(h);
67
- }
68
- });
69
- }
70
- }
71
-
72
- export default InterceptorManager;
@@ -1,50 +0,0 @@
1
- 'use strict';
2
-
3
- import AxiosError from './AxiosError.js';
4
- import isAbsoluteURL from '../helpers/isAbsoluteURL.js';
5
- import combineURLs from '../helpers/combineURLs.js';
6
-
7
- const malformedHttpProtocol = /^https?:(?!\/\/)/i;
8
- const httpProtocolControlCharacters = /[\t\n\r]/g;
9
-
10
- function stripLeadingC0ControlOrSpace(url) {
11
- let i = 0;
12
- while (i < url.length && url.charCodeAt(i) <= 0x20) {
13
- i++;
14
- }
15
- return url.slice(i);
16
- }
17
-
18
- function normalizeURLForProtocolCheck(url) {
19
- return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');
20
- }
21
-
22
- function assertValidHttpProtocolURL(url, config) {
23
- if (typeof url === 'string' && malformedHttpProtocol.test(normalizeURLForProtocolCheck(url))) {
24
- throw new AxiosError(
25
- 'Invalid URL: missing "//" after protocol',
26
- AxiosError.ERR_INVALID_URL,
27
- config
28
- );
29
- }
30
- }
31
-
32
- /**
33
- * Creates a new URL by combining the baseURL with the requestedURL,
34
- * only when the requestedURL is not already an absolute URL.
35
- * If the requestURL is absolute, this function returns the requestedURL untouched.
36
- *
37
- * @param {string} baseURL The base URL
38
- * @param {string} requestedURL Absolute or relative URL to combine
39
- *
40
- * @returns {string} The combined full path
41
- */
42
- export default function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
43
- assertValidHttpProtocolURL(requestedURL, config);
44
- let isRelativeUrl = !isAbsoluteURL(requestedURL);
45
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
46
- assertValidHttpProtocolURL(baseURL, config);
47
- return combineURLs(baseURL, requestedURL);
48
- }
49
- return requestedURL;
50
- }
@@ -1,89 +0,0 @@
1
- 'use strict';
2
-
3
- import transformData from './transformData.js';
4
- import isCancel from '../cancel/isCancel.js';
5
- import defaults from '../defaults/index.js';
6
- import CanceledError from '../cancel/CanceledError.js';
7
- import AxiosHeaders from '../core/AxiosHeaders.js';
8
- import adapters from '../adapters/adapters.js';
9
-
10
- /**
11
- * Throws a `CanceledError` if cancellation has been requested.
12
- *
13
- * @param {Object} config The config that is to be used for the request
14
- *
15
- * @returns {void}
16
- */
17
- function throwIfCancellationRequested(config) {
18
- if (config.cancelToken) {
19
- config.cancelToken.throwIfRequested();
20
- }
21
-
22
- if (config.signal && config.signal.aborted) {
23
- throw new CanceledError(null, config);
24
- }
25
- }
26
-
27
- /**
28
- * Dispatch a request to the server using the configured adapter.
29
- *
30
- * @param {object} config The config that is to be used for the request
31
- *
32
- * @returns {Promise} The Promise to be fulfilled
33
- */
34
- export default function dispatchRequest(config) {
35
- throwIfCancellationRequested(config);
36
-
37
- config.headers = AxiosHeaders.from(config.headers);
38
-
39
- // Transform request data
40
- config.data = transformData.call(config, config.transformRequest);
41
-
42
- if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
43
- config.headers.setContentType('application/x-www-form-urlencoded', false);
44
- }
45
-
46
- const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
47
-
48
- return adapter(config).then(
49
- function onAdapterResolution(response) {
50
- throwIfCancellationRequested(config);
51
-
52
- // Expose the current response on config so that transformResponse can
53
- // attach it to any AxiosError it throws (e.g. on JSON parse failure).
54
- // We clean it up afterwards to avoid polluting the config object.
55
- config.response = response;
56
- try {
57
- response.data = transformData.call(config, config.transformResponse, response);
58
- } finally {
59
- delete config.response;
60
- }
61
-
62
- response.headers = AxiosHeaders.from(response.headers);
63
-
64
- return response;
65
- },
66
- function onAdapterRejection(reason) {
67
- if (!isCancel(reason)) {
68
- throwIfCancellationRequested(config);
69
-
70
- // Transform response data
71
- if (reason && reason.response) {
72
- config.response = reason.response;
73
- try {
74
- reason.response.data = transformData.call(
75
- config,
76
- config.transformResponse,
77
- reason.response
78
- );
79
- } finally {
80
- delete config.response;
81
- }
82
- reason.response.headers = AxiosHeaders.from(reason.response.headers);
83
- }
84
- }
85
-
86
- return Promise.reject(reason);
87
- }
88
- );
89
- }