@zowe/db2-for-zowe-cli 6.1.17 → 6.1.19
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/README.md +12 -10
- package/lib/Db2PluginLifeCycle.d.ts +11 -9
- package/lib/Db2PluginLifeCycle.js +18 -13
- package/lib/Db2PluginLifeCycle.js.map +1 -1
- package/node_modules/adm-zip/adm-zip.js +32 -6
- package/node_modules/adm-zip/headers/entryHeader.js +13 -1
- package/node_modules/adm-zip/methods/inflater.js +33 -3
- package/node_modules/adm-zip/package.json +2 -2
- package/node_modules/adm-zip/util/errors.js +3 -0
- package/node_modules/adm-zip/util/utils.js +102 -14
- package/node_modules/adm-zip/zipEntry.js +43 -18
- package/node_modules/adm-zip/zipFile.js +10 -0
- package/node_modules/axios/CHANGELOG.md +62 -0
- package/node_modules/axios/README.md +236 -73
- package/node_modules/axios/dist/axios.js +1308 -357
- package/node_modules/axios/dist/axios.min.js +3 -3
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +1443 -403
- package/node_modules/axios/dist/esm/axios.js +1443 -403
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +1483 -348
- package/node_modules/axios/index.d.cts +24 -1
- package/node_modules/axios/index.d.ts +22 -1
- package/node_modules/axios/lib/adapters/fetch.js +136 -30
- package/node_modules/axios/lib/adapters/http.js +277 -74
- package/node_modules/axios/lib/adapters/xhr.js +172 -16
- package/node_modules/axios/lib/core/Axios.js +87 -27
- package/node_modules/axios/lib/core/AxiosError.js +59 -0
- package/node_modules/axios/lib/core/AxiosHeaders.js +17 -4
- package/node_modules/axios/lib/core/InterceptorManager.js +118 -8
- package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
- package/node_modules/axios/lib/core/buildFullPath.js +1 -13
- package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
- package/node_modules/axios/lib/core/dispatchRequest.js +28 -2
- package/node_modules/axios/lib/core/mergeConfig.js +183 -120
- package/node_modules/axios/lib/core/methodList.js +17 -0
- package/node_modules/axios/lib/defaults/index.js +2 -1
- package/node_modules/axios/lib/defaults/transitional.js +1 -0
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/AxiosTransformStream.js +11 -2
- package/node_modules/axios/lib/helpers/Http2Sessions.js +4 -1
- package/node_modules/axios/lib/helpers/HttpStatusCode.js +11 -1
- package/node_modules/axios/lib/helpers/composeSignals.js +6 -3
- package/node_modules/axios/lib/helpers/cookies.js +30 -6
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +34 -7
- package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
- package/node_modules/axios/lib/helpers/formDataToJSON.js +25 -1
- package/node_modules/axios/lib/helpers/fromDataURI.js +11 -4
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +4 -9
- package/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
- package/node_modules/axios/lib/helpers/parseHeaders.js +2 -1
- package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
- package/node_modules/axios/lib/helpers/progressEventReducer.js +1 -1
- package/node_modules/axios/lib/helpers/resolveConfig.js +20 -5
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +197 -6
- package/node_modules/axios/lib/helpers/throttle.js +3 -2
- package/node_modules/axios/lib/helpers/toFormData.js +14 -21
- package/node_modules/axios/lib/utils.js +192 -20
- package/node_modules/axios/package.json +1 -2
- package/node_modules/follow-redirects/README.md +27 -1
- package/node_modules/follow-redirects/index.js +11 -6
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/fs-extra/README.md +0 -1
- package/node_modules/fs-extra/lib/empty/index.js +4 -2
- package/node_modules/fs-extra/lib/util/stat.js +12 -2
- package/node_modules/fs-extra/package.json +1 -1
- package/node_modules/ibm_db/APIDocumentation.md +2883 -2024
- package/node_modules/ibm_db/LICENSE +23 -23
- package/node_modules/ibm_db/README.md +735 -735
- package/node_modules/ibm_db/binding.gyp +99 -98
- package/node_modules/ibm_db/installer/driverInstall.js +984 -958
- package/node_modules/ibm_db/installer/ifx.sh +38 -38
- package/node_modules/ibm_db/installer/setenv.sh +23 -23
- package/node_modules/ibm_db/installer/testODBCConnection.bat +51 -51
- package/node_modules/ibm_db/installer/testODBCConnection.sh +61 -61
- package/node_modules/ibm_db/lib/climacros.js +431 -431
- package/node_modules/ibm_db/lib/odbc.js +4293 -3487
- package/node_modules/ibm_db/lib/simple-queue.js +41 -41
- package/node_modules/ibm_db/package.json +70 -70
- package/node_modules/ibm_db/src/odbc.cpp +1495 -1396
- package/node_modules/ibm_db/src/odbc.h +477 -473
- package/node_modules/ibm_db/src/odbc_connection.cpp +1762 -1612
- package/node_modules/ibm_db/src/odbc_connection.h +228 -215
- package/node_modules/ibm_db/src/odbc_result.cpp +1547 -1547
- package/node_modules/ibm_db/src/odbc_result.h +152 -152
- package/node_modules/ibm_db/src/odbc_statement.cpp +2047 -861
- package/node_modules/ibm_db/src/odbc_statement.h +257 -135
- package/node_modules/ibm_db/src/strptime.c +389 -389
- package/node_modules/ibm_db/src/strptime.h +46 -46
- package/node_modules/ibm_db/test/README +23 -23
- package/node_modules/ibm_db/test/bench-insert.js +62 -62
- package/node_modules/ibm_db/test/bench-insertBatch10.js +74 -74
- package/node_modules/ibm_db/test/bench-insertBatch100.js +75 -75
- package/node_modules/ibm_db/test/bench-insertBatch1000.js +75 -75
- package/node_modules/ibm_db/test/bench-insertBatch10000.js +75 -75
- package/node_modules/ibm_db/test/bench-prepare-bind-execute-closeSync.js +60 -60
- package/node_modules/ibm_db/test/bench-prepare-bind-executeNonQuery.js +53 -53
- package/node_modules/ibm_db/test/bench-prepare-bindSync-execute-closeSync.js +50 -50
- package/node_modules/ibm_db/test/bench-prepare-bindSync-executeNonQuery.js +48 -48
- package/node_modules/ibm_db/test/bench-prepare-execute-closeSync.js +51 -51
- package/node_modules/ibm_db/test/bench-prepare-executeNonQuery.js +47 -47
- package/node_modules/ibm_db/test/bench-prepare-not.js +43 -43
- package/node_modules/ibm_db/test/bench-query-fetch.js +59 -59
- package/node_modules/ibm_db/test/bench-query-fetchAll.js +49 -49
- package/node_modules/ibm_db/test/bench-query-fetchAllSync.js +43 -43
- package/node_modules/ibm_db/test/bench-query.js +40 -40
- package/node_modules/ibm_db/test/bench-querySync-fetchArray.js +28 -28
- package/node_modules/ibm_db/test/bench-querySync.js +29 -29
- package/node_modules/ibm_db/test/common.d.ts +10 -10
- package/node_modules/ibm_db/test/common.js +127 -127
- package/node_modules/ibm_db/test/config.json +7 -7
- package/node_modules/ibm_db/test/config.zos.json +4 -4
- package/node_modules/ibm_db/test/data/sample1.txt +9 -9
- package/node_modules/ibm_db/test/data/trc.fmt +30114 -30114
- package/node_modules/ibm_db/test/nodeEE-leak-huge-query.js +152 -152
- package/node_modules/ibm_db/test/nodeEE-leak-multiple-query-multiple-connections.js +148 -148
- package/node_modules/ibm_db/test/nodeEE-leak-multiple-query-pool-connections.js +154 -154
- package/node_modules/ibm_db/test/nodeEE-leak-multiple-query.js +133 -133
- package/node_modules/ibm_db/test/nodeEE-stress-async-waterfall-multiple-connections.js +174 -174
- package/node_modules/ibm_db/test/nodeEE-stress-async-waterfall.js +169 -169
- package/node_modules/ibm_db/test/nodeEE-stress-mixed-query-multiple-connections.js +159 -159
- package/node_modules/ibm_db/test/nodeEE-stress-mixed-query.js +148 -148
- package/node_modules/ibm_db/test/odbc-bench.c +123 -123
- package/node_modules/ibm_db/test/perfTest.js +53 -53
- package/node_modules/ibm_db/test/quick-example.sh +30 -30
- package/node_modules/ibm_db/test/quick-example.ts +80 -80
- package/node_modules/ibm_db/test/run-bench.js +96 -96
- package/node_modules/ibm_db/test/run-nodeEE.js +132 -132
- package/node_modules/ibm_db/test/run-tests.js +132 -138
- package/node_modules/ibm_db/test/sql-cli.js +28 -28
- package/node_modules/ibm_db/test/test-all-data-types.js +109 -109
- package/node_modules/ibm_db/test/test-array-insert.js +178 -178
- package/node_modules/ibm_db/test/test-async-await.js +105 -105
- package/node_modules/ibm_db/test/test-attributes.js +34 -34
- package/node_modules/ibm_db/test/test-bad-pool-connection-prepare-execute.js +57 -57
- package/node_modules/ibm_db/test/test-basic-test.js +138 -138
- package/node_modules/ibm_db/test/test-binary-array-insert.js +73 -73
- package/node_modules/ibm_db/test/test-blob-from-file.js +90 -90
- package/node_modules/ibm_db/test/test-blob-insert.js +144 -144
- package/node_modules/ibm_db/test/test-blob-stream-insert.js +321 -299
- package/node_modules/ibm_db/test/test-blob-to-file.js +370 -370
- package/node_modules/ibm_db/test/test-block-fetch.js +364 -364
- package/node_modules/ibm_db/test/test-blocking-issue210.js +123 -123
- package/node_modules/ibm_db/test/test-call-async.js +64 -64
- package/node_modules/ibm_db/test/test-call-stmt.js +53 -53
- package/node_modules/ibm_db/test/test-cancel.js +703 -0
- package/node_modules/ibm_db/test/test-chinese-char.js +59 -59
- package/node_modules/ibm_db/test/test-connection.js +306 -0
- package/node_modules/ibm_db/test/test-date.js +32 -32
- package/node_modules/ibm_db/test/test-dbclob.js +93 -93
- package/node_modules/ibm_db/test/test-decimals.js +135 -135
- package/node_modules/ibm_db/test/test-describe-metadata.js +148 -0
- package/node_modules/ibm_db/test/test-executeFile.js +167 -167
- package/node_modules/ibm_db/test/test-executeFileSync.js +85 -85
- package/node_modules/ibm_db/test/test-fetch-apis.js +146 -146
- package/node_modules/ibm_db/test/test-fetchN.js +130 -130
- package/node_modules/ibm_db/test/test-getinfo.js +197 -197
- package/node_modules/ibm_db/test/test-ibm-db-issue14.js +58 -58
- package/node_modules/ibm_db/test/test-ibm-db-issue17.js +54 -54
- package/node_modules/ibm_db/test/test-ibm-db-issue18.js +54 -54
- package/node_modules/ibm_db/test/test-issue-1059-fetchAll-undefined.js +67 -67
- package/node_modules/ibm_db/test/test-issue-1080-array-blob-insert.js +40 -0
- package/node_modules/ibm_db/test/test-issue-54.js +39 -39
- package/node_modules/ibm_db/test/test-issue-get-column-value-2.js +44 -44
- package/node_modules/ibm_db/test/test-issue211.js +80 -80
- package/node_modules/ibm_db/test/test-issue253.js +39 -39
- package/node_modules/ibm_db/test/test-max-pool-size.js +96 -96
- package/node_modules/ibm_db/test/test-memory-leaks-new-objects.js +32 -32
- package/node_modules/ibm_db/test/test-multi-open-query-close.js +75 -75
- package/node_modules/ibm_db/test/test-param-put-data.js +713 -0
- package/node_modules/ibm_db/test/test-pool-idle-connection.js +72 -72
- package/node_modules/ibm_db/test/test-pool-operations.js +325 -0
- package/node_modules/ibm_db/test/test-pool-stale-connections.js +111 -111
- package/node_modules/ibm_db/test/test-pool-uncommited.js +33 -33
- package/node_modules/ibm_db/test/test-prepare-execute.js +339 -0
- package/node_modules/ibm_db/test/test-prepareSync-multiple-execution.js +93 -93
- package/node_modules/ibm_db/test/test-primary-foreign-keys.js +246 -0
- package/node_modules/ibm_db/test/test-procedures.js +243 -0
- package/node_modules/ibm_db/test/test-promise-all-data-types.js +42 -42
- package/node_modules/ibm_db/test/test-query-operations.js +405 -0
- package/node_modules/ibm_db/test/test-quick-example.js +25 -25
- package/node_modules/ibm_db/test/test-row-array-insert.js +167 -167
- package/node_modules/ibm_db/test/test-sp-array.js +54 -54
- package/node_modules/ibm_db/test/test-sp-dbc-6000.js +88 -88
- package/node_modules/ibm_db/test/test-sp-memleak.js +136 -136
- package/node_modules/ibm_db/test/test-sp-resultset-execute.js +269 -269
- package/node_modules/ibm_db/test/test-sp-resultset.js +228 -228
- package/node_modules/ibm_db/test/test-transactions.js +261 -0
- package/node_modules/ibm_db/test/test-typescript.js +48 -48
- package/node_modules/ibm_db/test/test-xml-datatype.js +70 -70
- package/node_modules/ibm_db/test/testWebApp.js +56 -56
- package/node_modules/ibm_db/test/trace +51 -51
- package/node_modules/ibm_db/test/typescript-apis-test.js +978 -978
- package/node_modules/ibm_db/test/webapp.html +17 -17
- package/node_modules/ibm_db/test/webapp.js +79 -79
- package/node_modules/ibm_db/typescript/README.md +28 -28
- package/node_modules/ibm_db/typescript/dist/Database.d.ts +26 -0
- package/node_modules/ibm_db/typescript/dist/ODBCStatement.d.ts +93 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/index.js +62 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/package.json +37 -0
- package/node_modules/which-typed-array/CHANGELOG.md +14 -0
- package/node_modules/which-typed-array/README.md +0 -2
- package/node_modules/which-typed-array/index.d.ts +288 -11
- package/node_modules/which-typed-array/index.js +6 -7
- package/node_modules/which-typed-array/package.json +12 -11
- package/package.json +10 -11
- package/node_modules/ibm_db/test/disabled/test-binding-statement-rebinding.js +0 -59
- package/node_modules/ibm_db/test/disabled/test-open-dont-close.js +0 -12
- package/node_modules/ibm_db/test/disabled/test-param-select-with-booleans-only.js +0 -21
- package/node_modules/ibm_db/test/disabled/test-param-select-with-decimals-only.js +0 -20
- package/node_modules/ibm_db/test/disabled/test-param-select-with-null.js +0 -21
- package/node_modules/ibm_db/test/disabled/test-param-select-with-nulls-mixed.js +0 -23
- package/node_modules/ibm_db/test/disabled/test-param-select-with-numbers-mixed.js +0 -22
- package/node_modules/ibm_db/test/disabled/test-param-select-with-numbers-only.js +0 -24
- package/node_modules/ibm_db/test/disabled/test-param-select-with-strings-only.js +0 -23
- package/node_modules/ibm_db/test/disabled/test-param-select-with-unicode.js +0 -15
- package/node_modules/ibm_db/test/disabled/test-prepare-bind-execute-closeSync.js +0 -62
- package/node_modules/ibm_db/test/disabled/test-prepare-bind-execute-error.js +0 -49
- package/node_modules/ibm_db/test/disabled/test-prepare-bind-execute-long-string.js +0 -63
- package/node_modules/ibm_db/test/disabled/test-prepare-bind-executeNonQuery.js +0 -63
- package/node_modules/ibm_db/test/disabled/test-prepare-bindSync-execute-closeSync.js +0 -46
- package/node_modules/ibm_db/test/disabled/test-prepare-bindSync-executeNonQuery.js +0 -50
- package/node_modules/ibm_db/test/disabled/test-prepare.js +0 -34
- package/node_modules/ibm_db/test/disabled/test-prepareSync.js +0 -29
- package/node_modules/ibm_db/test/disabled/test-query-select-fetchAll.js +0 -23
- package/node_modules/ibm_db/test/disabled/test-query-select-fetchAllSync.js +0 -23
- package/node_modules/ibm_db/test/disabled/test-query-select-unicode.js +0 -15
- package/node_modules/ibm_db/test/disabled/test-querySync-select-unicode.js +0 -20
- package/node_modules/ibm_db/test/test-affected-rows.js +0 -55
- package/node_modules/ibm_db/test/test-bad-connection-string.js +0 -30
- package/node_modules/ibm_db/test/test-binding-connection-timeOut.js +0 -31
- package/node_modules/ibm_db/test/test-binding-statement-executeSync.js +0 -84
- package/node_modules/ibm_db/test/test-binding-transaction-commit.js +0 -79
- package/node_modules/ibm_db/test/test-binding-transaction-commitSync.js +0 -53
- package/node_modules/ibm_db/test/test-closed.js +0 -14
- package/node_modules/ibm_db/test/test-connection-object.js +0 -16
- package/node_modules/ibm_db/test/test-describe-column.js +0 -92
- package/node_modules/ibm_db/test/test-describe-database.js +0 -18
- package/node_modules/ibm_db/test/test-describe-table.js +0 -31
- package/node_modules/ibm_db/test/test-domains-open.js +0 -19
- package/node_modules/ibm_db/test/test-global-open-close.js +0 -11
- package/node_modules/ibm_db/test/test-instantiate-one-and-end.js +0 -9
- package/node_modules/ibm_db/test/test-multi-open-close.js +0 -45
- package/node_modules/ibm_db/test/test-multi-openSync-closeSync.js +0 -52
- package/node_modules/ibm_db/test/test-open-close.js +0 -29
- package/node_modules/ibm_db/test/test-open-connectTimeout.js +0 -33
- package/node_modules/ibm_db/test/test-openSync.js +0 -31
- package/node_modules/ibm_db/test/test-pool-close.js +0 -120
- package/node_modules/ibm_db/test/test-pool-connect.js +0 -36
- package/node_modules/ibm_db/test/test-pool-rollbackTransaction.js +0 -35
- package/node_modules/ibm_db/test/test-prepareSync-bad-sql.js +0 -34
- package/node_modules/ibm_db/test/test-promise-open-close.js +0 -33
- package/node_modules/ibm_db/test/test-query-create-table-fetchSync.js +0 -23
- package/node_modules/ibm_db/test/test-query-create-table.js +0 -12
- package/node_modules/ibm_db/test/test-query-drop-table.js +0 -13
- package/node_modules/ibm_db/test/test-query-insert.js +0 -38
- package/node_modules/ibm_db/test/test-query-select-fetch.js +0 -21
- package/node_modules/ibm_db/test/test-query-select-fetchMode-array.js +0 -17
- package/node_modules/ibm_db/test/test-query-select.js +0 -64
- package/node_modules/ibm_db/test/test-queryResult.js +0 -35
- package/node_modules/ibm_db/test/test-queryStream.js +0 -43
- package/node_modules/ibm_db/test/test-querySync-select-with-exception.js +0 -25
- package/node_modules/ibm_db/test/test-querySync-select.js +0 -28
- package/node_modules/ibm_db/test/test-require-and-end.js +0 -8
- package/node_modules/ibm_db/test/test-statement-close.js +0 -118
- package/node_modules/ibm_db/test/test-transaction-commit-sync.js +0 -54
- package/node_modules/ibm_db/test/test-transaction-commit.js +0 -79
- package/node_modules/which-typed-array/eslint.config.mjs +0 -12
- package/node_modules/which-typed-array/test/index.js +0 -105
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/LICENSE +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/README.md +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/chownr.js +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/package.json +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/.travis.yml +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/LICENSE +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/README.md +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/lib/string_decoder.js +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/package.json +0 -0
|
@@ -3,9 +3,11 @@ import settle from '../core/settle.js';
|
|
|
3
3
|
import transitionalDefaults from '../defaults/transitional.js';
|
|
4
4
|
import AxiosError from '../core/AxiosError.js';
|
|
5
5
|
import CanceledError from '../cancel/CanceledError.js';
|
|
6
|
+
import normalizeURLForProtocolCheck from '../helpers/normalizeURLForProtocolCheck.js';
|
|
6
7
|
import parseProtocol from '../helpers/parseProtocol.js';
|
|
7
8
|
import platform from '../platform/index.js';
|
|
8
9
|
import AxiosHeaders from '../core/AxiosHeaders.js';
|
|
10
|
+
import cookies from '../helpers/cookies.js';
|
|
9
11
|
import { progressEventReducer } from '../helpers/progressEventReducer.js';
|
|
10
12
|
import resolveConfig from '../helpers/resolveConfig.js';
|
|
11
13
|
import { toByteStringHeaderObject } from '../helpers/sanitizeHeaderValue.js';
|
|
@@ -15,17 +17,60 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
|
15
17
|
export default isXHRAdapterSupported &&
|
|
16
18
|
function (config) {
|
|
17
19
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
18
|
-
|
|
20
|
+
let useAsyncXsrf;
|
|
21
|
+
try {
|
|
22
|
+
const store =
|
|
23
|
+
platform.hasStandardBrowserEnv && typeof window !== 'undefined' && window.cookieStore;
|
|
24
|
+
useAsyncXsrf = store && utils.isFunction(store.get);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
// A restricted Cookie Store getter must retain the synchronous fallback.
|
|
27
|
+
}
|
|
28
|
+
let xsrfCookieName;
|
|
29
|
+
const _config = resolveConfig(
|
|
30
|
+
config,
|
|
31
|
+
useAsyncXsrf
|
|
32
|
+
? (name) => {
|
|
33
|
+
xsrfCookieName = name;
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
: undefined
|
|
37
|
+
);
|
|
19
38
|
let requestData = _config.data;
|
|
20
39
|
const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
|
|
21
40
|
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
22
41
|
let onCanceled;
|
|
42
|
+
let timeoutId;
|
|
23
43
|
let uploadThrottled, downloadThrottled;
|
|
24
|
-
let flushUpload, flushDownload;
|
|
44
|
+
let flushUpload, flushDownload, flushDownloadWithEvent;
|
|
25
45
|
|
|
26
46
|
function done() {
|
|
27
|
-
|
|
28
|
-
|
|
47
|
+
clearTimeout(timeoutId);
|
|
48
|
+
// A final progress callback must not prevent the remaining cleanup.
|
|
49
|
+
// Report errors asynchronously, as onloadend and the throttle timer do.
|
|
50
|
+
try {
|
|
51
|
+
flushUpload && flushUpload(); // flush events
|
|
52
|
+
} catch (err) {
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
throw err;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
flushDownload && flushDownload(); // flush events
|
|
59
|
+
} catch (err) {
|
|
60
|
+
setTimeout(() => {
|
|
61
|
+
throw err;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// A flush can synchronously cancel the request and reenter done().
|
|
66
|
+
// In that case the inner call has already detached these listeners.
|
|
67
|
+
if (request) {
|
|
68
|
+
downloadThrottled && request.removeEventListener('progress', downloadThrottled);
|
|
69
|
+
if (request.upload) {
|
|
70
|
+
uploadThrottled && request.upload.removeEventListener('progress', uploadThrottled);
|
|
71
|
+
flushUpload && request.upload.removeEventListener('loadend', flushUpload);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
29
74
|
|
|
30
75
|
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
31
76
|
|
|
@@ -39,10 +84,55 @@ export default isXHRAdapterSupported &&
|
|
|
39
84
|
// Set the request timeout in MS
|
|
40
85
|
request.timeout = _config.timeout;
|
|
41
86
|
|
|
42
|
-
function onloadend() {
|
|
87
|
+
function onloadend(event) {
|
|
43
88
|
if (!request) {
|
|
44
89
|
return;
|
|
45
90
|
}
|
|
91
|
+
|
|
92
|
+
// Status 0 means no response was received, which onerror and onabort normally
|
|
93
|
+
// reject before this runs. Firefox 152 fires only readystatechange and loadend for
|
|
94
|
+
// navigation-canceled requests (https://bugzilla.mozilla.org/show_bug.cgi?id=1505389),
|
|
95
|
+
// leaving settle() to resolve them as an empty success. ECONNABORTED is the error
|
|
96
|
+
// onabort raised on Firefox 151. Reads over file:, which some environments report as
|
|
97
|
+
// status 0 on success, are excluded by the request URL's scheme after browser-style
|
|
98
|
+
// preprocessing, by the page origin's scheme for relative URLs (which inherit it), or
|
|
99
|
+
// by responseURL where implemented.
|
|
100
|
+
if (
|
|
101
|
+
request.status === 0 &&
|
|
102
|
+
(parseProtocol(normalizeURLForProtocolCheck(_config.url)) ||
|
|
103
|
+
parseProtocol(platform.origin)) !== 'file' &&
|
|
104
|
+
!(request.responseURL && request.responseURL.startsWith('file:'))
|
|
105
|
+
) {
|
|
106
|
+
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
107
|
+
done();
|
|
108
|
+
|
|
109
|
+
// Clean up request
|
|
110
|
+
request = null;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// When loadend is still dispatching, flushing with it gives progress
|
|
115
|
+
// listeners a final delivery whose event has a live target. The legacy
|
|
116
|
+
// ready-state fallback has no event, so replay its pending progress.
|
|
117
|
+
// A throwing listener must not block settlement; rethrow asynchronously,
|
|
118
|
+
// matching how listener errors surface on the throttle timer path.
|
|
119
|
+
try {
|
|
120
|
+
if (event) {
|
|
121
|
+
flushDownloadWithEvent && flushDownloadWithEvent(event);
|
|
122
|
+
} else {
|
|
123
|
+
flushDownload && flushDownload();
|
|
124
|
+
}
|
|
125
|
+
} catch (err) {
|
|
126
|
+
setTimeout(() => {
|
|
127
|
+
throw err;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// A final progress callback can cancel the request synchronously.
|
|
132
|
+
if (!request) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
46
136
|
// Prepare the response
|
|
47
137
|
const responseHeaders = AxiosHeaders.from(
|
|
48
138
|
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
@@ -131,6 +221,7 @@ export default isXHRAdapterSupported &&
|
|
|
131
221
|
|
|
132
222
|
// Handle timeout
|
|
133
223
|
request.ontimeout = function handleTimeout() {
|
|
224
|
+
if (!request) return;
|
|
134
225
|
let timeoutErrorMessage = _config.timeout
|
|
135
226
|
? 'timeout of ' + _config.timeout + 'ms exceeded'
|
|
136
227
|
: 'timeout exceeded';
|
|
@@ -155,13 +246,6 @@ export default isXHRAdapterSupported &&
|
|
|
155
246
|
// Remove Content-Type if data is undefined
|
|
156
247
|
requestData === undefined && requestHeaders.setContentType(null);
|
|
157
248
|
|
|
158
|
-
// Add headers to the request
|
|
159
|
-
if ('setRequestHeader' in request) {
|
|
160
|
-
utils.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
|
|
161
|
-
request.setRequestHeader(key, val);
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
|
|
165
249
|
// Add withCredentials to request if needed
|
|
166
250
|
if (!utils.isUndefined(_config.withCredentials)) {
|
|
167
251
|
request.withCredentials = !!_config.withCredentials;
|
|
@@ -174,7 +258,10 @@ export default isXHRAdapterSupported &&
|
|
|
174
258
|
|
|
175
259
|
// Handle progress if needed
|
|
176
260
|
if (onDownloadProgress) {
|
|
177
|
-
[downloadThrottled, flushDownload] = progressEventReducer(
|
|
261
|
+
[downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer(
|
|
262
|
+
onDownloadProgress,
|
|
263
|
+
true
|
|
264
|
+
);
|
|
178
265
|
request.addEventListener('progress', downloadThrottled);
|
|
179
266
|
}
|
|
180
267
|
|
|
@@ -195,12 +282,14 @@ export default isXHRAdapterSupported &&
|
|
|
195
282
|
return;
|
|
196
283
|
}
|
|
197
284
|
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
|
198
|
-
request
|
|
285
|
+
const xhr = request;
|
|
199
286
|
done();
|
|
200
287
|
request = null;
|
|
288
|
+
xhr.abort();
|
|
201
289
|
};
|
|
202
290
|
|
|
203
291
|
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
292
|
+
if (!request) return;
|
|
204
293
|
if (_config.signal) {
|
|
205
294
|
_config.signal.aborted
|
|
206
295
|
? onCanceled()
|
|
@@ -208,6 +297,8 @@ export default isXHRAdapterSupported &&
|
|
|
208
297
|
}
|
|
209
298
|
}
|
|
210
299
|
|
|
300
|
+
if (!request) return;
|
|
301
|
+
|
|
211
302
|
const protocol = parseProtocol(_config.url);
|
|
212
303
|
|
|
213
304
|
if (protocol && !platform.protocols.includes(protocol)) {
|
|
@@ -222,7 +313,72 @@ export default isXHRAdapterSupported &&
|
|
|
222
313
|
return;
|
|
223
314
|
}
|
|
224
315
|
|
|
225
|
-
|
|
226
|
-
|
|
316
|
+
const sendRequest = () => {
|
|
317
|
+
if (!request) return;
|
|
318
|
+
// Apply headers after an asynchronous XSRF read so existing headers are
|
|
319
|
+
// replaced through AxiosHeaders rather than appended by the native XHR.
|
|
320
|
+
if ('setRequestHeader' in request) {
|
|
321
|
+
utils.forEach(
|
|
322
|
+
toByteStringHeaderObject(requestHeaders),
|
|
323
|
+
function setRequestHeader(val, key) {
|
|
324
|
+
request.setRequestHeader(key, val);
|
|
325
|
+
}
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
request.send(requestData || null);
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
if (xsrfCookieName) {
|
|
332
|
+
// Native XHR timeout starts at send(). Cover cookie preparation and the
|
|
333
|
+
// subsequent request with the same budget and existing timeout handler.
|
|
334
|
+
const now =
|
|
335
|
+
typeof performance !== 'undefined' && utils.isFunction(performance.now)
|
|
336
|
+
? () => performance.now()
|
|
337
|
+
: Date.now;
|
|
338
|
+
const deadline = request.timeout > 0 ? now() + Number(request.timeout) : undefined;
|
|
339
|
+
const abortOnTimeout = () => {
|
|
340
|
+
if (!request) return;
|
|
341
|
+
const xhr = request;
|
|
342
|
+
xhr.ontimeout();
|
|
343
|
+
xhr.abort();
|
|
344
|
+
};
|
|
345
|
+
if (deadline !== undefined) {
|
|
346
|
+
const scheduleTimeout = () => {
|
|
347
|
+
const remaining = deadline - now();
|
|
348
|
+
if (remaining > 0) {
|
|
349
|
+
// Browser timers overflow above the signed 32-bit delay limit.
|
|
350
|
+
timeoutId = setTimeout(scheduleTimeout, Math.min(remaining, 0x7fffffff));
|
|
351
|
+
} else {
|
|
352
|
+
abortOnTimeout();
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
scheduleTimeout();
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
cookies
|
|
359
|
+
.readAsync(xsrfCookieName)
|
|
360
|
+
.then((value) => {
|
|
361
|
+
if (!request) return;
|
|
362
|
+
// Promise callbacks may run before an overdue timer after a busy task.
|
|
363
|
+
if (deadline !== undefined && now() >= deadline) {
|
|
364
|
+
abortOnTimeout();
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
if (value) {
|
|
368
|
+
const headerName =
|
|
369
|
+
utils.hasOwnProp(_config, 'xsrfHeaderName') && _config.xsrfHeaderName;
|
|
370
|
+
requestHeaders.set(headerName, value);
|
|
371
|
+
}
|
|
372
|
+
sendRequest();
|
|
373
|
+
})
|
|
374
|
+
.catch((error) => {
|
|
375
|
+
if (!request) return;
|
|
376
|
+
reject(AxiosError.from(error, null, config, request));
|
|
377
|
+
done();
|
|
378
|
+
request = null;
|
|
379
|
+
});
|
|
380
|
+
} else {
|
|
381
|
+
sendRequest();
|
|
382
|
+
}
|
|
227
383
|
});
|
|
228
384
|
};
|
|
@@ -6,12 +6,45 @@ import InterceptorManager from './InterceptorManager.js';
|
|
|
6
6
|
import dispatchRequest from './dispatchRequest.js';
|
|
7
7
|
import mergeConfig from './mergeConfig.js';
|
|
8
8
|
import buildFullPath from './buildFullPath.js';
|
|
9
|
+
import methodList from './methodList.js';
|
|
9
10
|
import validator from '../helpers/validator.js';
|
|
10
11
|
import AxiosHeaders from './AxiosHeaders.js';
|
|
11
12
|
import transitionalDefaults from '../defaults/transitional.js';
|
|
13
|
+
import { getCauseStackIndex } from './AxiosError.js';
|
|
12
14
|
|
|
13
15
|
const validators = validator.validators;
|
|
14
16
|
|
|
17
|
+
// Recognize header maps without consuming objects intended as literal values.
|
|
18
|
+
// AxiosHeaders from other builds share a brand and header-container interface,
|
|
19
|
+
// but not constructor identity. A tag and toJSON alone can describe a literal.
|
|
20
|
+
const isHeadersBucket = (value) => {
|
|
21
|
+
if (value == null || utils.isPlainObject(value) || value instanceof AxiosHeaders) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
return (
|
|
27
|
+
utils.isObject(value) &&
|
|
28
|
+
utils.getSafeProp(value, Symbol.toStringTag) === 'AxiosHeaders' &&
|
|
29
|
+
[
|
|
30
|
+
'toJSON',
|
|
31
|
+
'set',
|
|
32
|
+
'get',
|
|
33
|
+
'has',
|
|
34
|
+
'delete',
|
|
35
|
+
'clear',
|
|
36
|
+
'normalize',
|
|
37
|
+
'concat',
|
|
38
|
+
'toString',
|
|
39
|
+
Symbol.iterator,
|
|
40
|
+
].every((method) => utils.isFunction(utils.getSafeProp(value, method)))
|
|
41
|
+
);
|
|
42
|
+
} catch (e) {
|
|
43
|
+
// A failed optional brand probe must not prevent literal header serialization.
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
15
48
|
/**
|
|
16
49
|
* Create a new instance of Axios
|
|
17
50
|
*
|
|
@@ -41,37 +74,47 @@ class Axios {
|
|
|
41
74
|
return await this._request(configOrUrl, config);
|
|
42
75
|
} catch (err) {
|
|
43
76
|
if (err instanceof Error) {
|
|
44
|
-
|
|
77
|
+
try {
|
|
78
|
+
let dummy = {};
|
|
45
79
|
|
|
46
|
-
|
|
80
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
|
47
81
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (!dummy.stack) {
|
|
51
|
-
return '';
|
|
52
|
-
}
|
|
82
|
+
const dummyStack = dummy.stack;
|
|
83
|
+
let stack = '';
|
|
53
84
|
|
|
54
|
-
|
|
85
|
+
// slice off the Error: ... line
|
|
86
|
+
if (typeof dummyStack === 'string') {
|
|
87
|
+
const firstNewlineIndex = dummyStack.indexOf('\n');
|
|
88
|
+
|
|
89
|
+
stack = firstNewlineIndex === -1 ? '' : dummyStack.slice(firstNewlineIndex + 1);
|
|
90
|
+
}
|
|
55
91
|
|
|
56
|
-
return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
|
|
57
|
-
})();
|
|
58
|
-
try {
|
|
59
92
|
if (!err.stack) {
|
|
60
93
|
err.stack = stack;
|
|
61
|
-
// match without the 2 top stack lines
|
|
62
94
|
} else if (stack) {
|
|
95
|
+
// Match a common suffix after the 2 top frames when available,
|
|
96
|
+
// otherwise compare the full reconstructed stack.
|
|
63
97
|
const firstNewlineIndex = stack.indexOf('\n');
|
|
64
98
|
const secondNewlineIndex =
|
|
65
99
|
firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
|
|
66
|
-
const
|
|
67
|
-
secondNewlineIndex === -1 ?
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
100
|
+
const duplicateCheckSuffix =
|
|
101
|
+
secondNewlineIndex === -1 ? stack : stack.slice(secondNewlineIndex + 1);
|
|
102
|
+
|
|
103
|
+
// `AxiosError.from()` may have already inlined the wrapped error's
|
|
104
|
+
// stack under a `Caused by:` marker. Keep the reconstructed caller
|
|
105
|
+
// frames ahead of that marker so stack-only reporters do not read
|
|
106
|
+
// them as part of the low-level cause.
|
|
107
|
+
const currentStack = String(err.stack);
|
|
108
|
+
const causeIndex = getCauseStackIndex(err, currentStack);
|
|
109
|
+
const stackHead = causeIndex === -1 ? currentStack : currentStack.slice(0, causeIndex);
|
|
110
|
+
const causeSection = causeIndex === -1 ? '' : currentStack.slice(causeIndex);
|
|
111
|
+
|
|
112
|
+
if (!stackHead.endsWith(duplicateCheckSuffix)) {
|
|
113
|
+
err.stack = stackHead + '\n' + stack + causeSection;
|
|
71
114
|
}
|
|
72
115
|
}
|
|
73
116
|
} catch (e) {
|
|
74
|
-
//
|
|
117
|
+
// Ignore failures from custom stack hooks or un-writable stack properties.
|
|
75
118
|
}
|
|
76
119
|
}
|
|
77
120
|
|
|
@@ -103,6 +146,7 @@ class Axios {
|
|
|
103
146
|
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
|
104
147
|
advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
|
|
105
148
|
validateStatusUndefinedResolves: validators.transitional(validators.boolean),
|
|
149
|
+
encodeBasicAuthUsername: validators.transitional(validators.boolean),
|
|
106
150
|
},
|
|
107
151
|
false
|
|
108
152
|
);
|
|
@@ -128,7 +172,10 @@ class Axios {
|
|
|
128
172
|
// Set config.allowAbsoluteUrls
|
|
129
173
|
if (config.allowAbsoluteUrls !== undefined) {
|
|
130
174
|
// do nothing
|
|
131
|
-
} else if (
|
|
175
|
+
} else if (
|
|
176
|
+
utils.hasOwnProp(this.defaults, 'allowAbsoluteUrls') &&
|
|
177
|
+
this.defaults.allowAbsoluteUrls !== undefined
|
|
178
|
+
) {
|
|
132
179
|
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
133
180
|
} else {
|
|
134
181
|
config.allowAbsoluteUrls = true;
|
|
@@ -144,14 +191,27 @@ class Axios {
|
|
|
144
191
|
);
|
|
145
192
|
|
|
146
193
|
// Set config.method
|
|
147
|
-
config.method = (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
194
|
+
config.method = (
|
|
195
|
+
utils.getSafeProp(config, 'method') ||
|
|
196
|
+
utils.getSafeProp(this.defaults, 'method') ||
|
|
197
|
+
'get'
|
|
198
|
+
).toLowerCase();
|
|
199
|
+
|
|
200
|
+
// Flatten header defaults without consuming literal method-named headers.
|
|
201
|
+
const commonHeaders = utils.getSafeProp(headers, 'common');
|
|
202
|
+
const methodHeaders = utils.getSafeProp(headers, config.method);
|
|
203
|
+
const contextHeaders =
|
|
204
|
+
headers &&
|
|
205
|
+
utils.merge(
|
|
206
|
+
isHeadersBucket(commonHeaders) ? commonHeaders : undefined,
|
|
207
|
+
isHeadersBucket(methodHeaders) ? methodHeaders : undefined
|
|
208
|
+
);
|
|
151
209
|
|
|
152
210
|
headers &&
|
|
153
|
-
utils.forEach(
|
|
154
|
-
|
|
211
|
+
utils.forEach(methodList.concat('common'), (method) => {
|
|
212
|
+
if (isHeadersBucket(utils.getSafeProp(headers, method))) {
|
|
213
|
+
delete headers[method];
|
|
214
|
+
}
|
|
155
215
|
});
|
|
156
216
|
|
|
157
217
|
config.headers = AxiosHeaders.concat(contextHeaders, headers);
|
|
@@ -260,7 +320,7 @@ class Axios {
|
|
|
260
320
|
// Provide aliases for supported request methods
|
|
261
321
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
262
322
|
/*eslint func-names:0*/
|
|
263
|
-
Axios.prototype[method] = function (url, config) {
|
|
323
|
+
Axios.prototype[method] = async function (url, config) {
|
|
264
324
|
return this.request(
|
|
265
325
|
mergeConfig(config || {}, {
|
|
266
326
|
method,
|
|
@@ -273,7 +333,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
|
|
|
273
333
|
|
|
274
334
|
utils.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
|
|
275
335
|
function generateHTTPMethod(isForm) {
|
|
276
|
-
return function httpMethod(url, data, config) {
|
|
336
|
+
return async function httpMethod(url, data, config) {
|
|
277
337
|
return this.request(
|
|
278
338
|
mergeConfig(config || {}, {
|
|
279
339
|
method,
|
|
@@ -95,6 +95,61 @@ function aggregateErrorMessage(error) {
|
|
|
95
95
|
return message || error.name || 'AggregateError';
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
// Shared with `Axios.prototype.request`, which splices the reconstructed
|
|
99
|
+
// caller frames in ahead of this marker.
|
|
100
|
+
export const CAUSED_BY_SEPARATOR = '\nCaused by: ';
|
|
101
|
+
const $causeStack = Symbol('causeStack');
|
|
102
|
+
|
|
103
|
+
// Match the section we appended, not marker-like text in an error message or
|
|
104
|
+
// a replacement stack supplied by the caller. Do not re-read the cause's stack.
|
|
105
|
+
export function getCauseStackIndex(error, stack) {
|
|
106
|
+
const causeStack = utils.hasOwnProp(error, $causeStack) && error[$causeStack];
|
|
107
|
+
|
|
108
|
+
return causeStack && stack.endsWith(causeStack) ? stack.length - causeStack.length : -1;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Append the stack of a wrapped error to `target.stack`.
|
|
113
|
+
*
|
|
114
|
+
* `cause` already exposes the original error for tooling that walks the standard
|
|
115
|
+
* cause chain, but many error reporters read `stack` and nothing else. Inlining
|
|
116
|
+
* the wrapped stack there means those reporters surface the underlying failure
|
|
117
|
+
* instead of the axios frames that normalized it (see #6670).
|
|
118
|
+
*
|
|
119
|
+
* Every read is defensive: a custom `Error.prepareStackTrace` hook, a runtime
|
|
120
|
+
* without stack support, or a replaced `stack` property can leave the value
|
|
121
|
+
* missing, non-string, or read-only, and normalizing an error must not throw
|
|
122
|
+
* because of that.
|
|
123
|
+
*
|
|
124
|
+
* @param {Error} target The AxiosError being built.
|
|
125
|
+
* @param {Error} source The error being wrapped.
|
|
126
|
+
*
|
|
127
|
+
* @returns {void}
|
|
128
|
+
*/
|
|
129
|
+
function appendCauseStack(target, source) {
|
|
130
|
+
try {
|
|
131
|
+
const sourceStack = source && source.stack;
|
|
132
|
+
|
|
133
|
+
if (typeof sourceStack !== 'string' || !sourceStack) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const targetStack = target.stack;
|
|
138
|
+
|
|
139
|
+
if (typeof targetStack !== 'string' || !targetStack) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Each call to `from()` creates a fresh target. Re-wrapping includes the
|
|
144
|
+
// previous stack verbatim, adding one cause section per wrap.
|
|
145
|
+
const causeStack = CAUSED_BY_SEPARATOR + sourceStack;
|
|
146
|
+
target.stack = targetStack + causeStack;
|
|
147
|
+
Object.defineProperty(target, $causeStack, { __proto__: null, value: causeStack });
|
|
148
|
+
} catch (e) {
|
|
149
|
+
// Ignore failures from custom stack hooks or un-writable stack properties.
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
98
153
|
class AxiosError extends Error {
|
|
99
154
|
static from(error, code, config, request, response, customProps) {
|
|
100
155
|
// `AggregateError` (thrown by Node on dual-stack/Happy-Eyeballs connection
|
|
@@ -121,6 +176,10 @@ class AxiosError extends Error {
|
|
|
121
176
|
});
|
|
122
177
|
axiosError.name = error.name;
|
|
123
178
|
|
|
179
|
+
// Inline the wrapped stack for reporters that read only `stack`; the `cause`
|
|
180
|
+
// property above already covers cause-aware tooling.
|
|
181
|
+
appendCauseStack(axiosError, error);
|
|
182
|
+
|
|
124
183
|
// Preserve status from the original error if not already set from response
|
|
125
184
|
if (error.status != null && axiosError.status == null) {
|
|
126
185
|
axiosError.status = error.status;
|
|
@@ -150,9 +150,22 @@ function parseParameters(value) {
|
|
|
150
150
|
|
|
151
151
|
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
152
152
|
|
|
153
|
+
// `__proto__` is a valid field name, and the one name the uppercase mapping at
|
|
154
|
+
// the bottom of this file cannot reach: it is inherited from Object.prototype
|
|
155
|
+
// instead of being declared on AxiosHeaders.prototype, so `self.__proto__ = v`
|
|
156
|
+
// runs the inherited setter. That silently discards the header, and an array
|
|
157
|
+
// value replaces the instance prototype, taking every method with it.
|
|
158
|
+
// Store it under the same kind of case variant that mapping uses for `set` and
|
|
159
|
+
// `constructor`. Header lookup is caseless, so it reads back under either
|
|
160
|
+
// spelling, and no own `__proto__` slot is ever created for a later
|
|
161
|
+
// `Object.assign` to copy onto a plain object through the same setter.
|
|
162
|
+
const PROTO_HEADER_SLOT = '__Proto__';
|
|
163
|
+
|
|
164
|
+
const headerSlot = (name) => (name === '__proto__' ? PROTO_HEADER_SLOT : name);
|
|
165
|
+
|
|
153
166
|
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
154
167
|
if (utils.isFunction(filter)) {
|
|
155
|
-
return filter.call(
|
|
168
|
+
return filter.call(context, value, header);
|
|
156
169
|
}
|
|
157
170
|
|
|
158
171
|
if (isHeaderNameFilter) {
|
|
@@ -218,7 +231,7 @@ class AxiosHeaders {
|
|
|
218
231
|
_rewrite === true ||
|
|
219
232
|
(_rewrite === undefined && self[key] !== false)
|
|
220
233
|
) {
|
|
221
|
-
self[key || _header] = normalizeValue(_value);
|
|
234
|
+
self[headerSlot(key || _header)] = normalizeValue(_value);
|
|
222
235
|
}
|
|
223
236
|
}
|
|
224
237
|
|
|
@@ -347,7 +360,7 @@ class AxiosHeaders {
|
|
|
347
360
|
|
|
348
361
|
normalize(format) {
|
|
349
362
|
const self = this;
|
|
350
|
-
const headers =
|
|
363
|
+
const headers = Object.create(null);
|
|
351
364
|
|
|
352
365
|
utils.forEach(this, (value, header) => {
|
|
353
366
|
const key = utils.findKey(headers, header);
|
|
@@ -358,7 +371,7 @@ class AxiosHeaders {
|
|
|
358
371
|
return;
|
|
359
372
|
}
|
|
360
373
|
|
|
361
|
-
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
374
|
+
const normalized = headerSlot(format ? formatHeader(header) : String(header).trim());
|
|
362
375
|
|
|
363
376
|
if (normalized !== header) {
|
|
364
377
|
delete self[header];
|