node-red-contrib-tak-registration 0.11.1 → 0.11.5
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/node_modules/@types/node/LICENSE +0 -0
- package/node_modules/@types/node/README.md +4 -5
- package/node_modules/@types/node/assert/strict.d.ts +4 -4
- package/node_modules/@types/node/assert.d.ts +50 -26
- package/node_modules/@types/node/async_hooks.d.ts +13 -6
- package/node_modules/@types/node/buffer.d.ts +46 -38
- package/node_modules/@types/node/child_process.d.ts +278 -138
- package/node_modules/@types/node/cluster.d.ts +107 -89
- package/node_modules/@types/node/console.d.ts +18 -15
- package/node_modules/@types/node/constants.d.ts +12 -11
- package/node_modules/@types/node/crypto.d.ts +746 -268
- package/node_modules/@types/node/dgram.d.ts +82 -46
- package/node_modules/@types/node/diagnostics_channel.d.ts +3 -3
- package/node_modules/@types/node/dns/promises.d.ts +37 -26
- package/node_modules/@types/node/dns.d.ts +204 -63
- package/node_modules/@types/node/dom-events.d.ts +67 -71
- package/node_modules/@types/node/domain.d.ts +4 -4
- package/node_modules/@types/node/events.d.ts +99 -8
- package/node_modules/@types/node/fs/promises.d.ts +122 -85
- package/node_modules/@types/node/fs.d.ts +520 -316
- package/node_modules/@types/node/globals.d.ts +346 -286
- package/node_modules/@types/node/globals.global.d.ts +0 -0
- package/node_modules/@types/node/http.d.ts +321 -189
- package/node_modules/@types/node/http2.d.ts +630 -377
- package/node_modules/@types/node/https.d.ts +221 -112
- package/node_modules/@types/node/index.d.ts +0 -45
- package/node_modules/@types/node/inspector.d.ts +0 -1
- package/node_modules/@types/node/module.d.ts +75 -31
- package/node_modules/@types/node/net.d.ts +149 -93
- package/node_modules/@types/node/os.d.ts +10 -9
- package/node_modules/@types/node/package.json +88 -90
- package/node_modules/@types/node/path.d.ts +13 -13
- package/node_modules/@types/node/perf_hooks.d.ts +19 -18
- package/node_modules/@types/node/process.d.ts +170 -126
- package/node_modules/@types/node/punycode.d.ts +4 -4
- package/node_modules/@types/node/querystring.d.ts +14 -4
- package/node_modules/@types/node/readline/promises.d.ts +12 -7
- package/node_modules/@types/node/readline.d.ts +69 -56
- package/node_modules/@types/node/repl.d.ts +67 -61
- package/node_modules/@types/node/stream/consumers.d.ts +10 -10
- package/node_modules/@types/node/stream/promises.d.ts +56 -15
- package/node_modules/@types/node/stream/web.d.ts +40 -20
- package/node_modules/@types/node/stream.d.ts +365 -232
- package/node_modules/@types/node/string_decoder.d.ts +8 -8
- package/node_modules/@types/node/test.d.ts +133 -212
- package/node_modules/@types/node/timers/promises.d.ts +4 -4
- package/node_modules/@types/node/timers.d.ts +26 -11
- package/node_modules/@types/node/tls.d.ts +152 -72
- package/node_modules/@types/node/trace_events.d.ts +3 -3
- package/node_modules/@types/node/ts4.8/assert/strict.d.ts +4 -4
- package/node_modules/@types/node/ts4.8/assert.d.ts +50 -26
- package/node_modules/@types/node/ts4.8/async_hooks.d.ts +13 -6
- package/node_modules/@types/node/ts4.8/buffer.d.ts +47 -39
- package/node_modules/@types/node/ts4.8/child_process.d.ts +278 -138
- package/node_modules/@types/node/ts4.8/cluster.d.ts +107 -89
- package/node_modules/@types/node/ts4.8/console.d.ts +18 -15
- package/node_modules/@types/node/ts4.8/constants.d.ts +12 -11
- package/node_modules/@types/node/ts4.8/crypto.d.ts +746 -268
- package/node_modules/@types/node/ts4.8/dgram.d.ts +82 -46
- package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +3 -3
- package/node_modules/@types/node/ts4.8/dns/promises.d.ts +37 -26
- package/node_modules/@types/node/ts4.8/dns.d.ts +204 -63
- package/node_modules/@types/node/ts4.8/dom-events.d.ts +67 -71
- package/node_modules/@types/node/ts4.8/domain.d.ts +4 -4
- package/node_modules/@types/node/ts4.8/events.d.ts +99 -8
- package/node_modules/@types/node/ts4.8/fs/promises.d.ts +122 -85
- package/node_modules/@types/node/ts4.8/fs.d.ts +520 -316
- package/node_modules/@types/node/ts4.8/globals.d.ts +346 -286
- package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -0
- package/node_modules/@types/node/ts4.8/http.d.ts +321 -189
- package/node_modules/@types/node/ts4.8/http2.d.ts +630 -377
- package/node_modules/@types/node/ts4.8/https.d.ts +221 -112
- package/node_modules/@types/node/ts4.8/index.d.ts +0 -0
- package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -1
- package/node_modules/@types/node/ts4.8/module.d.ts +75 -31
- package/node_modules/@types/node/ts4.8/net.d.ts +149 -93
- package/node_modules/@types/node/ts4.8/os.d.ts +10 -9
- package/node_modules/@types/node/ts4.8/path.d.ts +13 -13
- package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +19 -18
- package/node_modules/@types/node/ts4.8/process.d.ts +170 -126
- package/node_modules/@types/node/ts4.8/punycode.d.ts +4 -4
- package/node_modules/@types/node/ts4.8/querystring.d.ts +14 -4
- package/node_modules/@types/node/ts4.8/readline/promises.d.ts +12 -7
- package/node_modules/@types/node/ts4.8/readline.d.ts +69 -56
- package/node_modules/@types/node/ts4.8/repl.d.ts +67 -61
- package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +10 -10
- package/node_modules/@types/node/ts4.8/stream/promises.d.ts +56 -15
- package/node_modules/@types/node/ts4.8/stream/web.d.ts +40 -20
- package/node_modules/@types/node/ts4.8/stream.d.ts +494 -223
- package/node_modules/@types/node/ts4.8/string_decoder.d.ts +8 -8
- package/node_modules/@types/node/ts4.8/test.d.ts +135 -214
- package/node_modules/@types/node/ts4.8/timers/promises.d.ts +4 -4
- package/node_modules/@types/node/ts4.8/timers.d.ts +26 -11
- package/node_modules/@types/node/ts4.8/tls.d.ts +152 -72
- package/node_modules/@types/node/ts4.8/trace_events.d.ts +3 -3
- package/node_modules/@types/node/ts4.8/tty.d.ts +10 -10
- package/node_modules/@types/node/ts4.8/url.d.ts +26 -14
- package/node_modules/@types/node/ts4.8/util.d.ts +187 -120
- package/node_modules/@types/node/ts4.8/v8.d.ts +4 -4
- package/node_modules/@types/node/ts4.8/vm.d.ts +58 -50
- package/node_modules/@types/node/ts4.8/wasi.d.ts +10 -4
- package/node_modules/@types/node/ts4.8/worker_threads.d.ts +83 -86
- package/node_modules/@types/node/ts4.8/zlib.d.ts +9 -9
- package/node_modules/@types/node/tty.d.ts +10 -10
- package/node_modules/@types/node/url.d.ts +26 -14
- package/node_modules/@types/node/util.d.ts +187 -120
- package/node_modules/@types/node/v8.d.ts +4 -4
- package/node_modules/@types/node/vm.d.ts +58 -50
- package/node_modules/@types/node/wasi.d.ts +10 -4
- package/node_modules/@types/node/worker_threads.d.ts +83 -86
- package/node_modules/@types/node/zlib.d.ts +9 -9
- package/node_modules/axios/CHANGELOG.md +225 -0
- package/node_modules/axios/README.md +273 -9
- package/node_modules/axios/dist/axios.js +249 -178
- package/node_modules/axios/dist/axios.js.map +1 -1
- package/node_modules/axios/dist/axios.min.js +1 -1
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +213 -193
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +213 -193
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- package/node_modules/axios/dist/esm/axios.min.js +1 -1
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +297 -213
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +20 -11
- package/node_modules/axios/index.d.ts +21 -12
- package/node_modules/axios/lib/adapters/adapters.js +33 -15
- package/node_modules/axios/lib/adapters/http.js +25 -12
- package/node_modules/axios/lib/adapters/xhr.js +17 -10
- package/node_modules/axios/lib/core/mergeConfig.js +1 -0
- package/node_modules/axios/lib/defaults/index.js +1 -1
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/cookies.js +39 -49
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +2 -2
- package/node_modules/axios/lib/platform/browser/index.js +0 -51
- package/node_modules/axios/lib/platform/common/utils.js +47 -0
- package/node_modules/axios/lib/platform/index.js +5 -1
- package/node_modules/axios/package.json +2 -1
- package/node_modules/call-bind/.eslintrc +0 -1
- package/node_modules/call-bind/.nycrc +0 -4
- package/node_modules/call-bind/CHANGELOG.md +35 -0
- package/node_modules/call-bind/README.md +63 -1
- package/node_modules/call-bind/index.js +10 -13
- package/node_modules/call-bind/package.json +33 -23
- package/node_modules/call-bind/test/callBound.js +0 -1
- package/node_modules/call-bind/test/index.js +18 -4
- package/node_modules/{function-bind → deep-equal}/.editorconfig +1 -1
- package/node_modules/deep-equal/.eslintrc +6 -0
- package/node_modules/deep-equal/.nycrc +17 -0
- package/node_modules/deep-equal/CHANGELOG.md +204 -4
- package/node_modules/deep-equal/assert.js +3 -0
- package/node_modules/deep-equal/package.json +39 -17
- package/node_modules/deep-equal/readme.markdown +28 -12
- package/node_modules/deep-equal/test/_tape.js +24 -3
- package/node_modules/deep-equal/test/cmp.js +1047 -48
- package/node_modules/define-data-property/CHANGELOG.md +10 -0
- package/node_modules/define-data-property/index.d.ts.map +1 -1
- package/node_modules/define-data-property/index.js +8 -0
- package/node_modules/define-data-property/package.json +11 -9
- package/node_modules/define-data-property/test/index.js +6 -11
- package/node_modules/define-data-property/tsconfig.json +1 -0
- package/node_modules/fast-xml-parser/CHANGELOG.md +11 -0
- package/node_modules/fast-xml-parser/package.json +5 -5
- package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +1 -0
- package/node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js +4 -0
- package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +6 -3
- package/node_modules/follow-redirects/index.js +16 -4
- package/node_modules/follow-redirects/package.json +2 -3
- package/node_modules/function-bind/.eslintrc +11 -5
- package/node_modules/function-bind/.github/FUNDING.yml +12 -0
- package/node_modules/function-bind/.github/SECURITY.md +3 -0
- package/node_modules/function-bind/.nycrc +13 -0
- package/node_modules/function-bind/CHANGELOG.md +136 -0
- package/node_modules/function-bind/README.md +25 -27
- package/node_modules/function-bind/implementation.js +44 -12
- package/node_modules/function-bind/package.json +38 -14
- package/node_modules/get-intrinsic/CHANGELOG.md +8 -0
- package/node_modules/get-intrinsic/index.js +1 -1
- package/node_modules/get-intrinsic/package.json +11 -11
- package/node_modules/has-property-descriptors/CHANGELOG.md +11 -0
- package/node_modules/has-property-descriptors/package.json +13 -6
- package/node_modules/hasown/.eslintrc +5 -0
- package/node_modules/hasown/.github/FUNDING.yml +12 -0
- package/node_modules/hasown/.nycrc +13 -0
- package/node_modules/hasown/CHANGELOG.md +20 -0
- package/node_modules/hasown/LICENSE +21 -0
- package/node_modules/hasown/README.md +40 -0
- package/node_modules/hasown/index.d.ts +3 -0
- package/node_modules/hasown/index.d.ts.map +1 -0
- package/node_modules/hasown/index.js +8 -0
- package/node_modules/hasown/package.json +91 -0
- package/node_modules/hasown/tsconfig.json +49 -0
- package/node_modules/set-function-length/.eslintrc +27 -0
- package/node_modules/set-function-length/.github/FUNDING.yml +12 -0
- package/node_modules/set-function-length/.nycrc +13 -0
- package/node_modules/set-function-length/CHANGELOG.md +41 -0
- package/node_modules/set-function-length/LICENSE +21 -0
- package/node_modules/set-function-length/README.md +56 -0
- package/node_modules/set-function-length/env.js +19 -0
- package/node_modules/set-function-length/index.js +41 -0
- package/node_modules/set-function-length/package.json +84 -0
- package/node_modules/undici-types/README.md +6 -0
- package/node_modules/undici-types/agent.d.ts +31 -0
- package/node_modules/undici-types/api.d.ts +43 -0
- package/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/node_modules/undici-types/cache.d.ts +36 -0
- package/node_modules/undici-types/client.d.ts +97 -0
- package/node_modules/undici-types/connector.d.ts +34 -0
- package/node_modules/undici-types/content-type.d.ts +21 -0
- package/node_modules/undici-types/cookies.d.ts +28 -0
- package/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/node_modules/undici-types/errors.d.ts +128 -0
- package/node_modules/undici-types/fetch.d.ts +209 -0
- package/node_modules/undici-types/file.d.ts +39 -0
- package/node_modules/undici-types/filereader.d.ts +54 -0
- package/node_modules/undici-types/formdata.d.ts +108 -0
- package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici-types/global-origin.d.ts +7 -0
- package/node_modules/undici-types/handlers.d.ts +9 -0
- package/node_modules/undici-types/header.d.ts +4 -0
- package/node_modules/undici-types/index.d.ts +63 -0
- package/node_modules/undici-types/interceptors.d.ts +5 -0
- package/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/node_modules/undici-types/mock-client.d.ts +25 -0
- package/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/node_modules/undici-types/package.json +55 -0
- package/node_modules/undici-types/patch.d.ts +71 -0
- package/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/node_modules/undici-types/pool.d.ts +28 -0
- package/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/node_modules/undici-types/readable.d.ts +61 -0
- package/node_modules/undici-types/webidl.d.ts +220 -0
- package/node_modules/undici-types/websocket.d.ts +131 -0
- package/package.json +3 -3
- package/tak-ingest.js +42 -23
- package/tak-registration.html +4 -4
- package/node_modules/define-data-property/tsinit +0 -109
- package/node_modules/function-bind/.jscs.json +0 -176
- package/node_modules/function-bind/.npmignore +0 -22
- package/node_modules/function-bind/.travis.yml +0 -168
- package/node_modules/has/LICENSE-MIT +0 -22
- package/node_modules/has/README.md +0 -18
- package/node_modules/has/package.json +0 -48
- package/node_modules/has/src/index.js +0 -5
- package/node_modules/has/test/index.js +0 -10
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
- [HTML Form Posting](#-html-form-posting-browser)
|
|
67
67
|
- [🆕 Progress capturing](#-progress-capturing)
|
|
68
68
|
- [🆕 Rate limiting](#-progress-capturing)
|
|
69
|
+
- [🆕 AxiosHeaders](#-axiosheaders)
|
|
69
70
|
- [Semver](#semver)
|
|
70
71
|
- [Promises](#promises)
|
|
71
72
|
- [TypeScript](#typescript)
|
|
@@ -167,7 +168,7 @@ Using unpkg CDN:
|
|
|
167
168
|
|
|
168
169
|
## Example
|
|
169
170
|
|
|
170
|
-
> **Note
|
|
171
|
+
> **Note**: CommonJS usage
|
|
171
172
|
> In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()`, use the following approach:
|
|
172
173
|
|
|
173
174
|
```js
|
|
@@ -384,12 +385,18 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
384
385
|
params: {
|
|
385
386
|
ID: 12345
|
|
386
387
|
},
|
|
387
|
-
|
|
388
|
-
// `paramsSerializer` is an optional config
|
|
388
|
+
|
|
389
|
+
// `paramsSerializer` is an optional config that allows you to customize serializing `params`.
|
|
389
390
|
paramsSerializer: {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
391
|
+
|
|
392
|
+
//Custom encoder function which sends key/value pairs in an iterative fashion.
|
|
393
|
+
encode?: (param: string): string => { /* Do custom operations here and return transformed string */ },
|
|
394
|
+
|
|
395
|
+
// Custom serializer function for the entire parameter. Allows user to mimic pre 1.x behaviour.
|
|
396
|
+
serialize?: (params: Record<string, any>, options?: ParamsSerializerOptions ),
|
|
397
|
+
|
|
398
|
+
//Configuration for formatting array indexes in the params.
|
|
399
|
+
indexes: false // Three available options: (1) indexes: null (leads to no brackets), (2) (default) indexes: false (leads to empty brackets), (3) indexes: true (leads to brackets with indexes).
|
|
393
400
|
},
|
|
394
401
|
|
|
395
402
|
// `data` is the data to be sent as the request body
|
|
@@ -445,6 +452,9 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
445
452
|
|
|
446
453
|
// `xsrfHeaderName` is the name of the http header that carries the xsrf token value
|
|
447
454
|
xsrfHeaderName: 'X-XSRF-TOKEN', // default
|
|
455
|
+
|
|
456
|
+
// `undefined` (default) - set XSRF header only for the same origin requests
|
|
457
|
+
withXSRFToken: boolean | undefined | ((config: InternalAxiosRequestConfig) => boolean | undefined),
|
|
448
458
|
|
|
449
459
|
// `onUploadProgress` allows handling of progress events for uploads
|
|
450
460
|
// browser & node.js
|
|
@@ -536,7 +546,7 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
536
546
|
// automatically. If set to `true` will also remove the 'content-encoding' header
|
|
537
547
|
// from the responses objects of all decompressed responses
|
|
538
548
|
// - Node only (XHR cannot turn off decompression)
|
|
539
|
-
decompress: true // default
|
|
549
|
+
decompress: true, // default
|
|
540
550
|
|
|
541
551
|
// `insecureHTTPParser` boolean.
|
|
542
552
|
// Indicates where to use an insecure HTTP parser that accepts invalid HTTP headers.
|
|
@@ -544,7 +554,7 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
544
554
|
// Using the insecure parser should be avoided.
|
|
545
555
|
// see options https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_http_request_url_options_callback
|
|
546
556
|
// see also https://nodejs.org/en/blog/vulnerability/february-2020-security-releases/#strict-http-header-parsing-none
|
|
547
|
-
insecureHTTPParser: undefined // default
|
|
557
|
+
insecureHTTPParser: undefined, // default
|
|
548
558
|
|
|
549
559
|
// transitional options for backward compatibility that may be removed in the newer versions
|
|
550
560
|
transitional: {
|
|
@@ -1264,7 +1274,7 @@ const {data} = await axios.post(SERVER_URL, readableStream, {
|
|
|
1264
1274
|
````
|
|
1265
1275
|
|
|
1266
1276
|
> **Note:**
|
|
1267
|
-
> Capturing FormData upload progress is
|
|
1277
|
+
> Capturing FormData upload progress is not currently supported in node.js environments.
|
|
1268
1278
|
|
|
1269
1279
|
> **⚠️ Warning**
|
|
1270
1280
|
> It is recommended to disable redirects by setting maxRedirects: 0 to upload the stream in the **node.js** environment,
|
|
@@ -1285,6 +1295,260 @@ const {data} = await axios.post(LOCAL_SERVER_URL, myBuffer, {
|
|
|
1285
1295
|
});
|
|
1286
1296
|
```
|
|
1287
1297
|
|
|
1298
|
+
## 🆕 AxiosHeaders
|
|
1299
|
+
|
|
1300
|
+
Axios has its own `AxiosHeaders` class to manipulate headers using a Map-like API that guarantees caseless work.
|
|
1301
|
+
Although HTTP is case-insensitive in headers, Axios will retain the case of the original header for stylistic reasons
|
|
1302
|
+
and for a workaround when servers mistakenly consider the header's case.
|
|
1303
|
+
The old approach of directly manipulating headers object is still available, but deprecated and not recommended for future usage.
|
|
1304
|
+
|
|
1305
|
+
### Working with headers
|
|
1306
|
+
|
|
1307
|
+
An AxiosHeaders object instance can contain different types of internal values. that control setting and merging logic.
|
|
1308
|
+
The final headers object with string values is obtained by Axios by calling the `toJSON` method.
|
|
1309
|
+
|
|
1310
|
+
> Note: By JSON here we mean an object consisting only of string values intended to be sent over the network.
|
|
1311
|
+
|
|
1312
|
+
The header value can be one of the following types:
|
|
1313
|
+
- `string` - normal string value that will be sent to the server
|
|
1314
|
+
- `null` - skip header when rendering to JSON
|
|
1315
|
+
- `false` - skip header when rendering to JSON, additionally indicates that `set` method must be called with `rewrite` option set to `true`
|
|
1316
|
+
to overwrite this value (Axios uses this internally to allow users to opt out of installing certain headers like `User-Agent` or `Content-Type`)
|
|
1317
|
+
- `undefined` - value is not set
|
|
1318
|
+
|
|
1319
|
+
> Note: The header value is considered set if it is not equal to undefined.
|
|
1320
|
+
|
|
1321
|
+
The headers object is always initialized inside interceptors and transformers:
|
|
1322
|
+
|
|
1323
|
+
```ts
|
|
1324
|
+
axios.interceptors.request.use((request: InternalAxiosRequestConfig) => {
|
|
1325
|
+
request.headers.set('My-header', 'value');
|
|
1326
|
+
|
|
1327
|
+
request.headers.set({
|
|
1328
|
+
"My-set-header1": "my-set-value1",
|
|
1329
|
+
"My-set-header2": "my-set-value2"
|
|
1330
|
+
});
|
|
1331
|
+
|
|
1332
|
+
request.headers.set('User-Agent', false); // disable subsequent setting the header by Axios
|
|
1333
|
+
|
|
1334
|
+
request.headers.setContentType('text/plain');
|
|
1335
|
+
|
|
1336
|
+
request.headers['My-set-header2'] = 'newValue' // direct access is deprecated
|
|
1337
|
+
|
|
1338
|
+
return request;
|
|
1339
|
+
}
|
|
1340
|
+
);
|
|
1341
|
+
````
|
|
1342
|
+
|
|
1343
|
+
You can iterate over an `AxiosHeaders` instance using a `for...of` statement:
|
|
1344
|
+
|
|
1345
|
+
````js
|
|
1346
|
+
const headers = new AxiosHeaders({
|
|
1347
|
+
foo: '1',
|
|
1348
|
+
bar: '2',
|
|
1349
|
+
baz: '3'
|
|
1350
|
+
});
|
|
1351
|
+
|
|
1352
|
+
for(const [header, value] of headers) {
|
|
1353
|
+
console.log(header, value);
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
// foo 1
|
|
1357
|
+
// bar 2
|
|
1358
|
+
// baz 3
|
|
1359
|
+
````
|
|
1360
|
+
|
|
1361
|
+
### new AxiosHeaders(headers?)
|
|
1362
|
+
|
|
1363
|
+
Constructs a new `AxiosHeaders` instance.
|
|
1364
|
+
|
|
1365
|
+
```
|
|
1366
|
+
constructor(headers?: RawAxiosHeaders | AxiosHeaders | string);
|
|
1367
|
+
```
|
|
1368
|
+
|
|
1369
|
+
If the headers object is a string, it will be parsed as RAW HTTP headers.
|
|
1370
|
+
|
|
1371
|
+
````js
|
|
1372
|
+
const headers = new AxiosHeaders(`
|
|
1373
|
+
Host: www.bing.com
|
|
1374
|
+
User-Agent: curl/7.54.0
|
|
1375
|
+
Accept: */*`);
|
|
1376
|
+
|
|
1377
|
+
console.log(headers);
|
|
1378
|
+
|
|
1379
|
+
// Object [AxiosHeaders] {
|
|
1380
|
+
// host: 'www.bing.com',
|
|
1381
|
+
// 'user-agent': 'curl/7.54.0',
|
|
1382
|
+
// accept: '*/*'
|
|
1383
|
+
// }
|
|
1384
|
+
````
|
|
1385
|
+
|
|
1386
|
+
### AxiosHeaders#set
|
|
1387
|
+
|
|
1388
|
+
```ts
|
|
1389
|
+
set(headerName, value: Axios, rewrite?: boolean);
|
|
1390
|
+
set(headerName, value, rewrite?: (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean);
|
|
1391
|
+
set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean);
|
|
1392
|
+
```
|
|
1393
|
+
|
|
1394
|
+
The `rewrite` argument controls the overwriting behavior:
|
|
1395
|
+
- `false` - do not overwrite if header's value is set (is not `undefined`)
|
|
1396
|
+
- `undefined` (default) - overwrite the header unless its value is set to `false`
|
|
1397
|
+
- `true` - rewrite anyway
|
|
1398
|
+
|
|
1399
|
+
The option can also accept a user-defined function that determines whether the value should be overwritten or not.
|
|
1400
|
+
|
|
1401
|
+
Returns `this`.
|
|
1402
|
+
|
|
1403
|
+
### AxiosHeaders#get(header)
|
|
1404
|
+
|
|
1405
|
+
```
|
|
1406
|
+
get(headerName: string, matcher?: true | AxiosHeaderMatcher): AxiosHeaderValue;
|
|
1407
|
+
get(headerName: string, parser: RegExp): RegExpExecArray | null;
|
|
1408
|
+
````
|
|
1409
|
+
|
|
1410
|
+
Returns the internal value of the header. It can take an extra argument to parse the header's value with `RegExp.exec`,
|
|
1411
|
+
matcher function or internal key-value parser.
|
|
1412
|
+
|
|
1413
|
+
```ts
|
|
1414
|
+
const headers = new AxiosHeaders({
|
|
1415
|
+
'Content-Type': 'multipart/form-data; boundary=Asrf456BGe4h'
|
|
1416
|
+
});
|
|
1417
|
+
|
|
1418
|
+
console.log(headers.get('Content-Type'));
|
|
1419
|
+
// multipart/form-data; boundary=Asrf456BGe4h
|
|
1420
|
+
|
|
1421
|
+
console.log(headers.get('Content-Type', true)); // parse key-value pairs from a string separated with \s,;= delimiters:
|
|
1422
|
+
// [Object: null prototype] {
|
|
1423
|
+
// 'multipart/form-data': undefined,
|
|
1424
|
+
// boundary: 'Asrf456BGe4h'
|
|
1425
|
+
// }
|
|
1426
|
+
|
|
1427
|
+
|
|
1428
|
+
console.log(headers.get('Content-Type', (value, name, headers) => {
|
|
1429
|
+
return String(value).replace(/a/g, 'ZZZ');
|
|
1430
|
+
}));
|
|
1431
|
+
// multipZZZrt/form-dZZZtZZZ; boundZZZry=Asrf456BGe4h
|
|
1432
|
+
|
|
1433
|
+
console.log(headers.get('Content-Type', /boundary=(\w+)/)?.[0]);
|
|
1434
|
+
// boundary=Asrf456BGe4h
|
|
1435
|
+
|
|
1436
|
+
```
|
|
1437
|
+
|
|
1438
|
+
Returns the value of the header.
|
|
1439
|
+
|
|
1440
|
+
### AxiosHeaders#has(header, matcher?)
|
|
1441
|
+
|
|
1442
|
+
```
|
|
1443
|
+
has(header: string, matcher?: AxiosHeaderMatcher): boolean;
|
|
1444
|
+
```
|
|
1445
|
+
|
|
1446
|
+
Returns `true` if the header is set (has no `undefined` value).
|
|
1447
|
+
|
|
1448
|
+
### AxiosHeaders#delete(header, matcher?)
|
|
1449
|
+
|
|
1450
|
+
```
|
|
1451
|
+
delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean;
|
|
1452
|
+
```
|
|
1453
|
+
|
|
1454
|
+
Returns `true` if at least one header has been removed.
|
|
1455
|
+
|
|
1456
|
+
### AxiosHeaders#clear(matcher?)
|
|
1457
|
+
|
|
1458
|
+
```
|
|
1459
|
+
clear(matcher?: AxiosHeaderMatcher): boolean;
|
|
1460
|
+
```
|
|
1461
|
+
|
|
1462
|
+
Removes all headers.
|
|
1463
|
+
Unlike the `delete` method matcher, this optional matcher will be used to match against the header name rather than the value.
|
|
1464
|
+
|
|
1465
|
+
```ts
|
|
1466
|
+
const headers = new AxiosHeaders({
|
|
1467
|
+
'foo': '1',
|
|
1468
|
+
'x-foo': '2',
|
|
1469
|
+
'x-bar': '3',
|
|
1470
|
+
});
|
|
1471
|
+
|
|
1472
|
+
console.log(headers.clear(/^x-/)); // true
|
|
1473
|
+
|
|
1474
|
+
console.log(headers.toJSON()); // [Object: null prototype] { foo: '1' }
|
|
1475
|
+
```
|
|
1476
|
+
|
|
1477
|
+
Returns `true` if at least one header has been cleared.
|
|
1478
|
+
|
|
1479
|
+
### AxiosHeaders#normalize(format);
|
|
1480
|
+
|
|
1481
|
+
If the headers object was changed directly, it can have duplicates with the same name but in different cases.
|
|
1482
|
+
This method normalizes the headers object by combining duplicate keys into one.
|
|
1483
|
+
Axios uses this method internally after calling each interceptor.
|
|
1484
|
+
Set `format` to true for converting headers name to lowercase and capitalize the initial letters (`cOntEnt-type` => `Content-Type`)
|
|
1485
|
+
|
|
1486
|
+
```js
|
|
1487
|
+
const headers = new AxiosHeaders({
|
|
1488
|
+
'foo': '1',
|
|
1489
|
+
});
|
|
1490
|
+
|
|
1491
|
+
headers.Foo = '2';
|
|
1492
|
+
headers.FOO = '3';
|
|
1493
|
+
|
|
1494
|
+
console.log(headers.toJSON()); // [Object: null prototype] { foo: '1', Foo: '2', FOO: '3' }
|
|
1495
|
+
console.log(headers.normalize().toJSON()); // [Object: null prototype] { foo: '3' }
|
|
1496
|
+
console.log(headers.normalize(true).toJSON()); // [Object: null prototype] { Foo: '3' }
|
|
1497
|
+
```
|
|
1498
|
+
|
|
1499
|
+
Returns `this`.
|
|
1500
|
+
|
|
1501
|
+
### AxiosHeaders#concat(...targets)
|
|
1502
|
+
|
|
1503
|
+
```
|
|
1504
|
+
concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
|
1505
|
+
```
|
|
1506
|
+
|
|
1507
|
+
Merges the instance with targets into a new `AxiosHeaders` instance. If the target is a string, it will be parsed as RAW HTTP headers.
|
|
1508
|
+
|
|
1509
|
+
Returns a new `AxiosHeaders` instance.
|
|
1510
|
+
|
|
1511
|
+
### AxiosHeaders#toJSON(asStrings?)
|
|
1512
|
+
|
|
1513
|
+
````
|
|
1514
|
+
toJSON(asStrings?: boolean): RawAxiosHeaders;
|
|
1515
|
+
````
|
|
1516
|
+
|
|
1517
|
+
Resolve all internal headers values into a new null prototype object.
|
|
1518
|
+
Set `asStrings` to true to resolve arrays as a string containing all elements, separated by commas.
|
|
1519
|
+
|
|
1520
|
+
### AxiosHeaders.from(thing?)
|
|
1521
|
+
|
|
1522
|
+
````
|
|
1523
|
+
from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
|
|
1524
|
+
````
|
|
1525
|
+
|
|
1526
|
+
Returns a new `AxiosHeaders` instance created from the raw headers passed in,
|
|
1527
|
+
or simply returns the given headers object if it's an `AxiosHeaders` instance.
|
|
1528
|
+
|
|
1529
|
+
### AxiosHeaders.concat(...targets)
|
|
1530
|
+
|
|
1531
|
+
````
|
|
1532
|
+
concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
|
1533
|
+
````
|
|
1534
|
+
|
|
1535
|
+
Returns a new `AxiosHeaders` instance created by merging the target objects.
|
|
1536
|
+
|
|
1537
|
+
### Shortcuts
|
|
1538
|
+
|
|
1539
|
+
The following shortcuts are available:
|
|
1540
|
+
|
|
1541
|
+
- `setContentType`, `getContentType`, `hasContentType`
|
|
1542
|
+
|
|
1543
|
+
- `setContentLength`, `getContentLength`, `hasContentLength`
|
|
1544
|
+
|
|
1545
|
+
- `setAccept`, `getAccept`, `hasAccept`
|
|
1546
|
+
|
|
1547
|
+
- `setUserAgent`, `getUserAgent`, `hasUserAgent`
|
|
1548
|
+
|
|
1549
|
+
- `setContentEncoding`, `getContentEncoding`, `hasContentEncoding`
|
|
1550
|
+
|
|
1551
|
+
|
|
1288
1552
|
## Semver
|
|
1289
1553
|
|
|
1290
1554
|
Until axios reaches a `1.0` release, breaking changes will be released with a new minor version. For example `0.5.1`, and `0.5.4` will have the same API, but `0.6.0` will have breaking changes.
|