@aws-sdk/util-format-url 3.342.0 → 3.347.0
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/dist-cjs/index.js +12 -1
- package/dist-es/index.js +11 -1
- package/package.json +3 -3
package/dist-cjs/index.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.formatUrl = void 0;
|
|
4
4
|
const querystring_builder_1 = require("@aws-sdk/querystring-builder");
|
|
5
5
|
function formatUrl(request) {
|
|
6
|
+
var _a, _b;
|
|
6
7
|
const { port, query } = request;
|
|
7
8
|
let { protocol, path, hostname } = request;
|
|
8
9
|
if (protocol && protocol.slice(-1) !== ":") {
|
|
@@ -18,6 +19,16 @@ function formatUrl(request) {
|
|
|
18
19
|
if (queryString && queryString[0] !== "?") {
|
|
19
20
|
queryString = `?${queryString}`;
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
+
let auth = "";
|
|
23
|
+
if (request.username != null || request.password != null) {
|
|
24
|
+
const username = (_a = request.username) !== null && _a !== void 0 ? _a : "";
|
|
25
|
+
const password = (_b = request.password) !== null && _b !== void 0 ? _b : "";
|
|
26
|
+
auth = `${username}:${password}@`;
|
|
27
|
+
}
|
|
28
|
+
let fragment = "";
|
|
29
|
+
if (request.fragment) {
|
|
30
|
+
fragment = `#${request.fragment}`;
|
|
31
|
+
}
|
|
32
|
+
return `${protocol}//${auth}${hostname}${path}${queryString}${fragment}`;
|
|
22
33
|
}
|
|
23
34
|
exports.formatUrl = formatUrl;
|
package/dist-es/index.js
CHANGED
|
@@ -15,5 +15,15 @@ export function formatUrl(request) {
|
|
|
15
15
|
if (queryString && queryString[0] !== "?") {
|
|
16
16
|
queryString = `?${queryString}`;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
let auth = "";
|
|
19
|
+
if (request.username != null || request.password != null) {
|
|
20
|
+
const username = request.username ?? "";
|
|
21
|
+
const password = request.password ?? "";
|
|
22
|
+
auth = `${username}:${password}@`;
|
|
23
|
+
}
|
|
24
|
+
let fragment = "";
|
|
25
|
+
if (request.fragment) {
|
|
26
|
+
fragment = `#${request.fragment}`;
|
|
27
|
+
}
|
|
28
|
+
return `${protocol}//${auth}${hostname}${path}${queryString}${fragment}`;
|
|
19
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-format-url",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.347.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aws-sdk/querystring-builder": "3.
|
|
24
|
-
"@aws-sdk/types": "3.
|
|
23
|
+
"@aws-sdk/querystring-builder": "3.347.0",
|
|
24
|
+
"@aws-sdk/types": "3.347.0",
|
|
25
25
|
"tslib": "^2.5.0"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|