@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
|
@@ -7,6 +7,7 @@ import toFormData from '../helpers/toFormData.js';
|
|
|
7
7
|
import toURLEncodedForm from '../helpers/toURLEncodedForm.js';
|
|
8
8
|
import platform from '../platform/index.js';
|
|
9
9
|
import formDataToJSON from '../helpers/formDataToJSON.js';
|
|
10
|
+
import methodList from '../core/methodList.js';
|
|
10
11
|
|
|
11
12
|
const own = (obj, key) => (obj != null && utils.hasOwnProp(obj, key) ? obj[key] : undefined);
|
|
12
13
|
|
|
@@ -170,7 +171,7 @@ const defaults = {
|
|
|
170
171
|
},
|
|
171
172
|
};
|
|
172
173
|
|
|
173
|
-
utils.forEach(
|
|
174
|
+
utils.forEach(methodList, (method) => {
|
|
174
175
|
defaults.headers[method] = {};
|
|
175
176
|
});
|
|
176
177
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.21.0";
|
|
@@ -69,11 +69,15 @@ class AxiosTransformStream extends stream.Transform {
|
|
|
69
69
|
|
|
70
70
|
const divider = 1000 / timeWindow;
|
|
71
71
|
const bytesThreshold = maxRate / divider;
|
|
72
|
-
|
|
72
|
+
let minChunkSize =
|
|
73
73
|
internals.minChunkSize !== false
|
|
74
74
|
? Math.max(internals.minChunkSize, bytesThreshold * 0.01)
|
|
75
75
|
: 0;
|
|
76
76
|
|
|
77
|
+
if (maxRate) {
|
|
78
|
+
minChunkSize = Math.min(bytesThreshold, minChunkSize);
|
|
79
|
+
}
|
|
80
|
+
|
|
77
81
|
const pushChunk = (_chunk, _callback) => {
|
|
78
82
|
const bytes = Buffer.byteLength(_chunk);
|
|
79
83
|
internals.bytesSeen += bytes;
|
|
@@ -92,6 +96,9 @@ class AxiosTransformStream extends stream.Transform {
|
|
|
92
96
|
};
|
|
93
97
|
|
|
94
98
|
const transformChunk = (_chunk, _callback) => {
|
|
99
|
+
if (this.destroyed) {
|
|
100
|
+
return _callback();
|
|
101
|
+
}
|
|
95
102
|
const chunkSize = Buffer.byteLength(_chunk);
|
|
96
103
|
let chunkRemainder = null;
|
|
97
104
|
let maxChunkSize = readableHighWaterMark;
|
|
@@ -120,7 +127,9 @@ class AxiosTransformStream extends stream.Transform {
|
|
|
120
127
|
}
|
|
121
128
|
|
|
122
129
|
if (bytesLeft < maxChunkSize) {
|
|
123
|
-
|
|
130
|
+
// A buffer boundary must consume at least one byte. Carry any
|
|
131
|
+
// fractional allowance forward in the next accounting window.
|
|
132
|
+
maxChunkSize = Math.max(1, Math.floor(bytesLeft));
|
|
124
133
|
}
|
|
125
134
|
}
|
|
126
135
|
|
|
@@ -15,6 +15,7 @@ class Http2Sessions {
|
|
|
15
15
|
|
|
16
16
|
getSession(authority, options) {
|
|
17
17
|
options = Object.assign(
|
|
18
|
+
Object.create(null),
|
|
18
19
|
{
|
|
19
20
|
sessionTimeout: 1000,
|
|
20
21
|
},
|
|
@@ -92,7 +93,7 @@ class Http2Sessions {
|
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
stream.once('close', () => {
|
|
95
|
-
if (!--streamsCount) {
|
|
96
|
+
if (!--streamsCount && !removed) {
|
|
96
97
|
timer = setTimeout(() => {
|
|
97
98
|
timer = null;
|
|
98
99
|
removeSession();
|
|
@@ -105,6 +106,8 @@ class Http2Sessions {
|
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
session.once('close', removeSession);
|
|
109
|
+
session.once('error', removeSession);
|
|
110
|
+
session.once('goaway', removeSession);
|
|
108
111
|
|
|
109
112
|
let entry = [session, options];
|
|
110
113
|
|
|
@@ -35,14 +35,22 @@ const HttpStatusCode = {
|
|
|
35
35
|
Gone: 410,
|
|
36
36
|
LengthRequired: 411,
|
|
37
37
|
PreconditionFailed: 412,
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use `ContentTooLarge` instead.
|
|
40
|
+
*/
|
|
38
41
|
PayloadTooLarge: 413,
|
|
42
|
+
ContentTooLarge: 413,
|
|
39
43
|
UriTooLong: 414,
|
|
40
44
|
UnsupportedMediaType: 415,
|
|
41
45
|
RangeNotSatisfiable: 416,
|
|
42
46
|
ExpectationFailed: 417,
|
|
43
47
|
ImATeapot: 418,
|
|
44
48
|
MisdirectedRequest: 421,
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated Use `UnprocessableContent` instead.
|
|
51
|
+
*/
|
|
45
52
|
UnprocessableEntity: 422,
|
|
53
|
+
UnprocessableContent: 422,
|
|
46
54
|
Locked: 423,
|
|
47
55
|
FailedDependency: 424,
|
|
48
56
|
TooEarly: 425,
|
|
@@ -72,7 +80,9 @@ const HttpStatusCode = {
|
|
|
72
80
|
};
|
|
73
81
|
|
|
74
82
|
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
75
|
-
HttpStatusCode[value]
|
|
83
|
+
if (HttpStatusCode[value] === undefined) {
|
|
84
|
+
HttpStatusCode[value] = key;
|
|
85
|
+
}
|
|
76
86
|
});
|
|
77
87
|
|
|
78
88
|
export default HttpStatusCode;
|
|
@@ -34,12 +34,15 @@ const composeSignals = (signals, timeout) => {
|
|
|
34
34
|
}, timeout);
|
|
35
35
|
|
|
36
36
|
const unsubscribe = () => {
|
|
37
|
-
if (!signals) {
|
|
37
|
+
if (!signals) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
38
40
|
timer && clearTimeout(timer);
|
|
39
41
|
timer = null;
|
|
40
42
|
signals.forEach((signal) => {
|
|
41
|
-
signal
|
|
42
|
-
|
|
43
|
+
const unsubscribeSignal = utils.getSafeProp(signal, 'unsubscribe');
|
|
44
|
+
utils.isFunction(unsubscribeSignal)
|
|
45
|
+
? unsubscribeSignal.call(signal, onabort)
|
|
43
46
|
: signal.removeEventListener('abort', onabort);
|
|
44
47
|
});
|
|
45
48
|
signals = null;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import utils from '../utils.js';
|
|
2
2
|
import platform from '../platform/index.js';
|
|
3
3
|
|
|
4
|
+
const decodeCookieValue = (value) => {
|
|
5
|
+
try {
|
|
6
|
+
return decodeURIComponent(value);
|
|
7
|
+
} catch (e) {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
4
12
|
export default platform.hasStandardBrowserEnv
|
|
5
13
|
? // Standard browser envs support document.cookie
|
|
6
14
|
{
|
|
@@ -30,26 +38,39 @@ export default platform.hasStandardBrowserEnv
|
|
|
30
38
|
|
|
31
39
|
read(name) {
|
|
32
40
|
if (typeof document === 'undefined') return null;
|
|
41
|
+
const cookieString = document.cookie;
|
|
42
|
+
if (!cookieString) return null;
|
|
33
43
|
// Match name=value by splitting on the semicolon separator instead of building a
|
|
34
44
|
// RegExp from `name` — interpolating an unescaped string into a RegExp would let
|
|
35
45
|
// metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
|
|
36
46
|
// match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
|
|
37
47
|
// "; ", so ignore optional whitespace before each cookie name.
|
|
38
|
-
const cookies =
|
|
48
|
+
const cookies = cookieString.split(';');
|
|
39
49
|
for (let i = 0; i < cookies.length; i++) {
|
|
40
50
|
const cookie = cookies[i].replace(/^\s+/, '');
|
|
41
51
|
const eq = cookie.indexOf('=');
|
|
42
52
|
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
43
|
-
|
|
44
|
-
return decodeURIComponent(cookie.slice(eq + 1));
|
|
45
|
-
} catch (e) {
|
|
46
|
-
return cookie.slice(eq + 1);
|
|
47
|
-
}
|
|
53
|
+
return decodeCookieValue(cookie.slice(eq + 1));
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
56
|
return null;
|
|
51
57
|
},
|
|
52
58
|
|
|
59
|
+
async readAsync(name) {
|
|
60
|
+
try {
|
|
61
|
+
const store = typeof window !== 'undefined' && window.cookieStore;
|
|
62
|
+
if (store && utils.isFunction(store.get)) {
|
|
63
|
+
const cookie = await store.get(name);
|
|
64
|
+
// Both APIs expose stored bytes; preserve Axios's existing URI decoding.
|
|
65
|
+
return cookie ? decodeCookieValue(cookie.value) : null;
|
|
66
|
+
}
|
|
67
|
+
} catch (e) {
|
|
68
|
+
// Restricted or unavailable storage retains the synchronous fallback.
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return this.read(name);
|
|
72
|
+
},
|
|
73
|
+
|
|
53
74
|
remove(name) {
|
|
54
75
|
this.write(name, '', Date.now() - 86400000, '/');
|
|
55
76
|
},
|
|
@@ -60,5 +81,8 @@ export default platform.hasStandardBrowserEnv
|
|
|
60
81
|
read() {
|
|
61
82
|
return null;
|
|
62
83
|
},
|
|
84
|
+
async readAsync() {
|
|
85
|
+
return null;
|
|
86
|
+
},
|
|
63
87
|
remove() {},
|
|
64
88
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Estimate data: URL byte lengths *without* allocating large buffers.
|
|
3
3
|
* - Fetch percent-decodes a base64 body before decoding it.
|
|
4
4
|
* - Node's Buffer.from(body, 'base64') sizes its backing allocation from the
|
|
5
|
-
*
|
|
5
|
+
* percent-decoded body, including ignored characters and content after padding.
|
|
6
6
|
* - Non-base64 data is percent-decoded and then encoded as UTF-8.
|
|
7
7
|
*/
|
|
8
8
|
const isHexDigit = (charCode) =>
|
|
@@ -50,6 +50,31 @@ const estimateBase64BufferAllocation = (body) => {
|
|
|
50
50
|
return Math.floor(((len - padding) * 3) / 4);
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
const estimatePercentDecodedBase64BufferAllocation = (body) => {
|
|
54
|
+
// Ordinary Base64 needs only its length and trailing padding.
|
|
55
|
+
if (body.indexOf('%') === -1) {
|
|
56
|
+
return estimateBase64BufferAllocation(body);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let length = 0;
|
|
60
|
+
let previous = 0;
|
|
61
|
+
let last = 0;
|
|
62
|
+
|
|
63
|
+
for (let i = 0, len = body.length; i < len; i++) {
|
|
64
|
+
let code = body.charCodeAt(i);
|
|
65
|
+
if (code === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
|
|
66
|
+
code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
|
|
67
|
+
i += 2;
|
|
68
|
+
}
|
|
69
|
+
length++;
|
|
70
|
+
previous = last;
|
|
71
|
+
last = code;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const padding = last === 61 ? (previous === 61 ? 2 : 1) : 0;
|
|
75
|
+
return Math.floor(((length - padding) * 3) / 4);
|
|
76
|
+
};
|
|
77
|
+
|
|
53
78
|
const estimatePercentDecodedBase64Bytes = (body) => {
|
|
54
79
|
const len = body.length;
|
|
55
80
|
let significant = 0;
|
|
@@ -95,16 +120,16 @@ const estimatePercentDecodedBase64Bytes = (body) => {
|
|
|
95
120
|
return base64Bytes(significant);
|
|
96
121
|
};
|
|
97
122
|
|
|
98
|
-
const estimateDataURLBytes = (url, estimateBase64) => {
|
|
123
|
+
const estimateDataURLBytes = (url, estimateBase64, base64Pattern) => {
|
|
99
124
|
if (!url || typeof url !== 'string') return 0;
|
|
100
|
-
if (
|
|
125
|
+
if (!/^data:/i.test(url)) return 0;
|
|
101
126
|
|
|
102
127
|
const comma = url.indexOf(',');
|
|
103
128
|
if (comma < 0) return 0;
|
|
104
129
|
|
|
105
130
|
const meta = url.slice(5, comma);
|
|
106
131
|
const body = url.slice(comma + 1);
|
|
107
|
-
const isBase64 =
|
|
132
|
+
const isBase64 = base64Pattern.test(meta);
|
|
108
133
|
|
|
109
134
|
if (isBase64) {
|
|
110
135
|
return estimateBase64(body);
|
|
@@ -151,16 +176,18 @@ export default function estimateDataURLDecodedBytes(url) {
|
|
|
151
176
|
|
|
152
177
|
return estimateDataURLBytes(
|
|
153
178
|
fragmentIndex === -1 ? url : url.slice(0, fragmentIndex),
|
|
154
|
-
estimatePercentDecodedBase64Bytes
|
|
179
|
+
estimatePercentDecodedBase64Bytes,
|
|
180
|
+
/; *base64[\t\n\f\r ]*$/i
|
|
155
181
|
);
|
|
156
182
|
}
|
|
157
183
|
|
|
158
184
|
/**
|
|
159
|
-
* Estimate the Buffer backing allocation used
|
|
185
|
+
* Estimate the Buffer backing allocation used after Node's percent-decoding step.
|
|
160
186
|
*
|
|
161
187
|
* @param {string} url
|
|
162
188
|
* @returns {number}
|
|
163
189
|
*/
|
|
164
190
|
export function estimateDataURLBufferAllocation(url) {
|
|
165
|
-
|
|
191
|
+
// Match fromDataURI's case-insensitive protocol and encoding suffix.
|
|
192
|
+
return estimateDataURLBytes(url, estimatePercentDecodedBase64BufferAllocation, /;base64$/i);
|
|
166
193
|
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import utils from '../utils.js';
|
|
2
|
+
|
|
3
|
+
const CRLF = '\r\n';
|
|
4
|
+
const normalizeLines = (value) => String(value).replace(/\r\n|\r|\n/g, CRLF);
|
|
5
|
+
const escapeName = (value) =>
|
|
6
|
+
String(value).replace(/[\r\n"]/g, (char) =>
|
|
7
|
+
char === '\r' ? '%0D' : char === '\n' ? '%0A' : '%22'
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
// Count UTF-8 bytes without allocating an encoded copy of a field. FormData
|
|
11
|
+
// string values normalize line endings; Blob/File contents remain unchanged.
|
|
12
|
+
const stringBytes = (value, normalize) => {
|
|
13
|
+
let length = 0;
|
|
14
|
+
for (let i = 0; i < value.length; i++) {
|
|
15
|
+
const code = value.charCodeAt(i);
|
|
16
|
+
if (normalize && (code === 13 || code === 10)) {
|
|
17
|
+
if (code === 13 && value.charCodeAt(i + 1) === 10) i++;
|
|
18
|
+
length += 2;
|
|
19
|
+
} else if (code < 0x80) {
|
|
20
|
+
length++;
|
|
21
|
+
} else if (code < 0x800) {
|
|
22
|
+
length += 2;
|
|
23
|
+
} else if (
|
|
24
|
+
code >= 0xd800 &&
|
|
25
|
+
code <= 0xdbff &&
|
|
26
|
+
value.charCodeAt(i + 1) >= 0xdc00 &&
|
|
27
|
+
value.charCodeAt(i + 1) <= 0xdfff
|
|
28
|
+
) {
|
|
29
|
+
length += 4;
|
|
30
|
+
i++;
|
|
31
|
+
} else {
|
|
32
|
+
length += 3;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return length;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Describe serialization failures independently of any request library.
|
|
39
|
+
export class FormDataError extends TypeError {
|
|
40
|
+
constructor(message, reason) {
|
|
41
|
+
super(message);
|
|
42
|
+
this.name = 'FormDataError';
|
|
43
|
+
this.reason = reason;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// The caller supplies the boundary, Blob implementation, and limit error.
|
|
48
|
+
export default function formDataToBlob(form, Blob, limit, limitError, boundary) {
|
|
49
|
+
if (!utils.isFunction(Blob)) {
|
|
50
|
+
throw new FormDataError('Blob is not supported', 'blob');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (
|
|
54
|
+
!utils.isString(boundary) ||
|
|
55
|
+
!/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(boundary) ||
|
|
56
|
+
/ $/.test(boundary)
|
|
57
|
+
) {
|
|
58
|
+
throw new FormDataError('Invalid multipart boundary', 'boundary');
|
|
59
|
+
}
|
|
60
|
+
const footer = '--' + boundary + '--' + CRLF;
|
|
61
|
+
let length = footer.length;
|
|
62
|
+
const parts = [];
|
|
63
|
+
const checkLength = (extra) => {
|
|
64
|
+
if (length + extra > limit) throw limitError();
|
|
65
|
+
};
|
|
66
|
+
checkLength(0);
|
|
67
|
+
|
|
68
|
+
for (const [name, value] of form) {
|
|
69
|
+
const isString = utils.isString(value);
|
|
70
|
+
const valueLength = isString ? stringBytes(value, true) : value.size;
|
|
71
|
+
if (!Number.isFinite(valueLength) || valueLength < 0) {
|
|
72
|
+
throw new FormDataError('Unsupported FormData part size', 'part');
|
|
73
|
+
}
|
|
74
|
+
// Reject large values and names before building normalized header strings.
|
|
75
|
+
checkLength(
|
|
76
|
+
valueLength +
|
|
77
|
+
stringBytes(name, true) +
|
|
78
|
+
(!isString && value.name ? stringBytes(value.name, false) : 0) +
|
|
79
|
+
(!isString && value.type ? stringBytes(value.type, false) : 0)
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
let header =
|
|
83
|
+
'--' +
|
|
84
|
+
boundary +
|
|
85
|
+
CRLF +
|
|
86
|
+
'Content-Disposition: form-data; name="' +
|
|
87
|
+
escapeName(normalizeLines(name)) +
|
|
88
|
+
'"';
|
|
89
|
+
if (!isString) {
|
|
90
|
+
header +=
|
|
91
|
+
'; filename="' +
|
|
92
|
+
escapeName(utils.isString(value.name) ? value.name : 'blob') +
|
|
93
|
+
'"' +
|
|
94
|
+
CRLF +
|
|
95
|
+
'Content-Type: ' +
|
|
96
|
+
String(value.type || 'application/octet-stream').replace(/[\r\n]/g, '');
|
|
97
|
+
}
|
|
98
|
+
header += CRLF + CRLF;
|
|
99
|
+
const partLength = stringBytes(header, false) + valueLength + CRLF.length;
|
|
100
|
+
checkLength(partLength);
|
|
101
|
+
length += partLength;
|
|
102
|
+
parts.push({ header, value, isString });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Native Blob composition retains existing Blob/File data. No file is read
|
|
106
|
+
// and no complete multipart ArrayBuffer is created to determine its length.
|
|
107
|
+
const blobParts = [];
|
|
108
|
+
for (const part of parts) {
|
|
109
|
+
blobParts.push(part.header, part.isString ? normalizeLines(part.value) : part.value, CRLF);
|
|
110
|
+
}
|
|
111
|
+
blobParts.push(footer);
|
|
112
|
+
return new Blob(blobParts, { type: 'multipart/form-data; boundary=' + boundary });
|
|
113
|
+
}
|
|
@@ -65,6 +65,29 @@ function arrayToObject(arr) {
|
|
|
65
65
|
return obj;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
function normalizeArray(value) {
|
|
69
|
+
if (!utils.isArray(value)) return value;
|
|
70
|
+
|
|
71
|
+
const keys = Object.keys(value);
|
|
72
|
+
return keys.length !== value.length || keys.some((key, index) => key !== String(index))
|
|
73
|
+
? arrayToObject(value)
|
|
74
|
+
: value;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function normalizeArrays(obj) {
|
|
78
|
+
const pending = [obj];
|
|
79
|
+
while (pending.length) {
|
|
80
|
+
const target = pending.pop();
|
|
81
|
+
Object.keys(target).forEach((key) => {
|
|
82
|
+
const value = (target[key] = normalizeArray(target[key]));
|
|
83
|
+
if (utils.isArray(value) || utils.isPlainObject(value)) {
|
|
84
|
+
pending.push(value);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return obj;
|
|
89
|
+
}
|
|
90
|
+
|
|
68
91
|
/**
|
|
69
92
|
* It takes a FormData object and returns a JavaScript object
|
|
70
93
|
*
|
|
@@ -86,6 +109,7 @@ function formDataToJSON(formData) {
|
|
|
86
109
|
|
|
87
110
|
if (isLast) {
|
|
88
111
|
if (utils.hasOwnProp(target, name)) {
|
|
112
|
+
target[name] = normalizeArray(target[name]);
|
|
89
113
|
target[name] = utils.isArray(target[name])
|
|
90
114
|
? target[name].concat(value)
|
|
91
115
|
: [target[name], value];
|
|
@@ -116,7 +140,7 @@ function formDataToJSON(formData) {
|
|
|
116
140
|
buildPath(parsePropPath(name), value, obj, 0);
|
|
117
141
|
});
|
|
118
142
|
|
|
119
|
-
return obj;
|
|
143
|
+
return normalizeArrays(obj);
|
|
120
144
|
}
|
|
121
145
|
|
|
122
146
|
return null;
|
|
@@ -6,7 +6,10 @@ import platform from '../platform/index.js';
|
|
|
6
6
|
|
|
7
7
|
// RFC 2397: data:[<mediatype>][;base64],<data>
|
|
8
8
|
// mediatype = type/subtype followed by optional ;name=value parameters
|
|
9
|
-
|
|
9
|
+
// The `i` flag makes the `;base64` token case-insensitive, matching the WHATWG
|
|
10
|
+
// URL/Fetch data URL processor (and therefore the fetch adapter and browsers).
|
|
11
|
+
// The remaining character classes do not depend on letter case.
|
|
12
|
+
const DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/i;
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* Parse data uri to a Buffer or Blob
|
|
@@ -49,9 +52,13 @@ export default function fromDataURI(uri, asBlob, options) {
|
|
|
49
52
|
mime = 'text/plain' + params;
|
|
50
53
|
}
|
|
51
54
|
|
|
52
|
-
const buffer =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
const buffer =
|
|
56
|
+
encoding === 'base64'
|
|
57
|
+
? Buffer.from(
|
|
58
|
+
body.replace(/%([\da-f]{2})/gi, (_, hex) => String.fromCharCode(parseInt(hex, 16))),
|
|
59
|
+
'base64'
|
|
60
|
+
)
|
|
61
|
+
: Buffer.from(decodeURIComponent(body), encoding);
|
|
55
62
|
|
|
56
63
|
if (asBlob) {
|
|
57
64
|
if (!_Blob) {
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import platform from '../platform/index.js';
|
|
2
2
|
|
|
3
3
|
export default platform.hasStandardBrowserEnv
|
|
4
|
-
? ((origin
|
|
5
|
-
url = new URL(url, platform.origin);
|
|
4
|
+
? ((origin) => (url) => {
|
|
5
|
+
url = new URL(url, document.baseURI || platform.origin);
|
|
6
6
|
|
|
7
7
|
return (
|
|
8
|
-
origin.protocol === url.protocol &&
|
|
9
|
-
origin.host === url.host &&
|
|
10
|
-
(isMSIE || origin.port === url.port)
|
|
8
|
+
origin.protocol === url.protocol && origin.host === url.host && origin.port === url.port
|
|
11
9
|
);
|
|
12
|
-
})(
|
|
13
|
-
new URL(platform.origin),
|
|
14
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
15
|
-
)
|
|
10
|
+
})(new URL(platform.origin))
|
|
16
11
|
: () => true;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const urlParserControlCharacters = /[\t\n\r]/g;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Match WHATWG URL preprocessing before checking a URL's protocol.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} url
|
|
9
|
+
*
|
|
10
|
+
* @returns {string}
|
|
11
|
+
*/
|
|
12
|
+
export default function normalizeURLForProtocolCheck(url) {
|
|
13
|
+
if (typeof url !== 'string') {
|
|
14
|
+
return url;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let start = 0;
|
|
18
|
+
|
|
19
|
+
while (start < url.length && url.charCodeAt(start) <= 0x20) {
|
|
20
|
+
start++;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return url.slice(start).replace(urlParserControlCharacters, '');
|
|
24
|
+
}
|
|
@@ -39,7 +39,8 @@ const ignoreDuplicateOf = utils.toObjectSet([
|
|
|
39
39
|
* @returns {Object} Headers parsed into an object
|
|
40
40
|
*/
|
|
41
41
|
export default (rawHeaders) => {
|
|
42
|
-
|
|
42
|
+
// Header names are data, including __proto__; avoid inherited setters.
|
|
43
|
+
const parsed = Object.create(null);
|
|
43
44
|
let key;
|
|
44
45
|
let val;
|
|
45
46
|
let i;
|
|
@@ -7,7 +7,7 @@ export const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
7
7
|
const _speedometer = speedometer(50, 250);
|
|
8
8
|
|
|
9
9
|
return throttle((e) => {
|
|
10
|
-
if (!e ||
|
|
10
|
+
if (!e || !utils.isNumber(e.loaded)) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
const rawLoaded = e.loaded;
|
|
@@ -22,7 +22,9 @@ const encodeUTF8 = (str) =>
|
|
|
22
22
|
String.fromCharCode(parseInt(hex, 16))
|
|
23
23
|
);
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const readCookie = (name) => cookies.read(name);
|
|
26
|
+
|
|
27
|
+
function resolveConfig(config, readXsrfCookie = readCookie) {
|
|
26
28
|
const newConfig = mergeConfig({}, config);
|
|
27
29
|
|
|
28
30
|
// Read only own properties to prevent prototype pollution gadgets
|
|
@@ -51,11 +53,22 @@ function resolveConfig(config) {
|
|
|
51
53
|
if (auth) {
|
|
52
54
|
const username = utils.getSafeProp(auth, 'username') || '';
|
|
53
55
|
const password = utils.getSafeProp(auth, 'password') || '';
|
|
56
|
+
const transitional = own('transitional');
|
|
57
|
+
const encodeUsername =
|
|
58
|
+
transitional &&
|
|
59
|
+
utils.hasOwnProp(transitional, 'encodeBasicAuthUsername') &&
|
|
60
|
+
transitional.encodeBasicAuthUsername === true;
|
|
54
61
|
|
|
55
62
|
try {
|
|
56
63
|
headers.set(
|
|
57
64
|
'Authorization',
|
|
58
|
-
|
|
65
|
+
// Preserve legacy username bytes unless the caller opts in to UTF-8.
|
|
66
|
+
'Basic ' +
|
|
67
|
+
btoa(
|
|
68
|
+
(encodeUsername ? encodeUTF8(username) : username) +
|
|
69
|
+
':' +
|
|
70
|
+
(password ? encodeUTF8(password) : '')
|
|
71
|
+
)
|
|
59
72
|
);
|
|
60
73
|
} catch (e) {
|
|
61
74
|
throw AxiosError.from(e, AxiosError.ERR_BAD_OPTION_VALUE, config);
|
|
@@ -63,15 +76,17 @@ function resolveConfig(config) {
|
|
|
63
76
|
}
|
|
64
77
|
|
|
65
78
|
if (utils.isFormData(data)) {
|
|
79
|
+
const getHeaders = utils.getSafeProp(data, 'getHeaders');
|
|
80
|
+
|
|
66
81
|
if (
|
|
67
82
|
platform.hasStandardBrowserEnv ||
|
|
68
83
|
platform.hasStandardBrowserWebWorkerEnv ||
|
|
69
84
|
utils.isReactNative(data)
|
|
70
85
|
) {
|
|
71
86
|
headers.setContentType(undefined); // browser/web worker/RN handles it
|
|
72
|
-
} else if (utils.isFunction(
|
|
87
|
+
} else if (utils.isFunction(getHeaders)) {
|
|
73
88
|
// Node.js FormData (like form-data package)
|
|
74
|
-
setFormDataHeaders(headers,
|
|
89
|
+
setFormDataHeaders(headers, getHeaders.call(data), own('formDataHeaderPolicy'));
|
|
75
90
|
}
|
|
76
91
|
}
|
|
77
92
|
|
|
@@ -91,7 +106,7 @@ function resolveConfig(config) {
|
|
|
91
106
|
withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
|
|
92
107
|
|
|
93
108
|
if (shouldSendXSRF) {
|
|
94
|
-
const xsrfValue = xsrfHeaderName && xsrfCookieName &&
|
|
109
|
+
const xsrfValue = xsrfHeaderName && xsrfCookieName && readXsrfCookie(xsrfCookieName);
|
|
95
110
|
|
|
96
111
|
if (xsrfValue) {
|
|
97
112
|
headers.set(xsrfHeaderName, xsrfValue);
|