@e-mc/request 0.9.7 → 0.9.8
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 +4 -4
- package/index.js +2 -5
- package/package.json +3 -3
- package/util.js +3 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.8/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { IModule, ModuleConstructor } from "./index";
|
|
@@ -201,9 +201,9 @@ instance.get("http://hostname/path/config.yml", options).then(data => {
|
|
|
201
201
|
|
|
202
202
|
## References
|
|
203
203
|
|
|
204
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
205
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
206
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
204
|
+
- https://www.unpkg.com/@e-mc/types@0.9.8/lib/http.d.ts
|
|
205
|
+
- https://www.unpkg.com/@e-mc/types@0.9.8/lib/request.d.ts
|
|
206
|
+
- https://www.unpkg.com/@e-mc/types@0.9.8/lib/settings.d.ts
|
|
207
207
|
|
|
208
208
|
* https://www.npmjs.com/package/@types/node
|
|
209
209
|
|
package/index.js
CHANGED
|
@@ -1574,11 +1574,8 @@ class Request extends module_1 {
|
|
|
1574
1574
|
if (proxy) {
|
|
1575
1575
|
const pkg = secure ? 'https-proxy-agent' : 'http-proxy-agent';
|
|
1576
1576
|
try {
|
|
1577
|
-
const
|
|
1578
|
-
|
|
1579
|
-
agentTimeout ?? (agentTimeout = proxy.agentTimeout);
|
|
1580
|
-
agent = require(pkg)(keepAlive || agentTimeout > 0 ? { protocol, hostname: proxyname, port, username, password, keepAlive, timeout: agentTimeout } : href);
|
|
1581
|
-
const proxyHeaders = this[kHeaders] && getBaseHeaders(href, this[kHeaders]) || getBaseHeaders(href, HTTP.HEADERS);
|
|
1577
|
+
const proxyHeaders = this[kHeaders] && getBaseHeaders(proxy.host.href, this[kHeaders]) || getBaseHeaders(proxy.host.href, HTTP.HEADERS);
|
|
1578
|
+
agent = require(pkg)(proxy.host, typeof keepAlive === 'boolean' || agentTimeout > 0 || proxyHeaders ? { keepAlive: keepAlive ?? true, timeout: agentTimeout, headers: proxyHeaders } : undefined);
|
|
1582
1579
|
if (proxyHeaders) {
|
|
1583
1580
|
baseHeaders = { ...baseHeaders, ...proxyHeaders };
|
|
1584
1581
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/request",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.8",
|
|
4
4
|
"description": "Request constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"license": "BSD 3-Clause",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/module": "0.9.
|
|
24
|
-
"@e-mc/types": "0.9.
|
|
23
|
+
"@e-mc/module": "0.9.8",
|
|
24
|
+
"@e-mc/types": "0.9.8",
|
|
25
25
|
"combined-stream": "^1.0.8",
|
|
26
26
|
"js-yaml": "^4.1.0",
|
|
27
27
|
"picomatch": "^4.0.2",
|
package/util.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.cleanupStream = exports.byteLength = exports.hasSameStat = exports.getSize = exports.hasSize = exports.getTransferRate = exports.fromSeconds = exports.asFloat = exports.asInt = exports.trimPath = exports.isRetryable = exports.checkRetryable = exports.hasBasicAuth = exports.getBasicAuth = exports.normalizeHeaders = exports.parseHeader = void 0;
|
|
3
3
|
const path = require("path");
|
|
4
|
+
const util = require("util");
|
|
4
5
|
const fs = require("fs");
|
|
5
6
|
const module_1 = require("@e-mc/module");
|
|
6
7
|
const types_1 = require("@e-mc/types");
|
|
8
|
+
const SUPPORTED_USVSTRING = module_1.supported(16, 8);
|
|
7
9
|
const safeInt = (value) => value >= 0 ? Math.min(value, Number.MAX_SAFE_INTEGER) : NaN;
|
|
8
10
|
function parseHeader(headers, name) {
|
|
9
11
|
const value = headers[name];
|
|
@@ -52,7 +54,7 @@ function getBasicAuth(username, password) {
|
|
|
52
54
|
if ((0, types_1.isObject)(username)) {
|
|
53
55
|
({ username, password } = username);
|
|
54
56
|
}
|
|
55
|
-
return (0, types_1.isString)(username) ? encodeURIComponent(username) + ((0, types_1.isString)(password) ? ':' + encodeURIComponent(password) : '') + '@' : '';
|
|
57
|
+
return (0, types_1.isString)(username) ? encodeURIComponent(SUPPORTED_USVSTRING ? util.toUSVString(username) : username) + ((0, types_1.isString)(password) ? ':' + encodeURIComponent(SUPPORTED_USVSTRING ? util.toUSVString(password) : password) : '') + '@' : '';
|
|
56
58
|
}
|
|
57
59
|
exports.getBasicAuth = getBasicAuth;
|
|
58
60
|
function hasBasicAuth(value) {
|