@lambdatest/smartui-cli 4.0.2 → 4.0.3
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/index.cjs +14 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -822,7 +822,7 @@ var auth_default = (ctx) => {
|
|
|
822
822
|
};
|
|
823
823
|
|
|
824
824
|
// package.json
|
|
825
|
-
var version = "4.0.
|
|
825
|
+
var version = "4.0.3";
|
|
826
826
|
var package_default = {
|
|
827
827
|
name: "@lambdatest/smartui-cli",
|
|
828
828
|
version,
|
|
@@ -1552,6 +1552,7 @@ function processSnapshot(snapshot, ctx) {
|
|
|
1552
1552
|
yield page.route("**/*", (route, request) => __async(this, null, function* () {
|
|
1553
1553
|
const requestUrl = request.url();
|
|
1554
1554
|
const requestHostname = new URL(requestUrl).hostname;
|
|
1555
|
+
let requestOptions = { timeout: REQUEST_TIMEOUT };
|
|
1555
1556
|
try {
|
|
1556
1557
|
if (/\.(mp3|mp4|wav|ogg|webm)$/i.test(request.url())) {
|
|
1557
1558
|
throw new Error("resource type mp3/mp4/wav/ogg/webm");
|
|
@@ -1559,18 +1560,24 @@ function processSnapshot(snapshot, ctx) {
|
|
|
1559
1560
|
ctx.config.allowedHostnames.push(new URL(snapshot.url).hostname);
|
|
1560
1561
|
if (ctx.config.enableJavaScript)
|
|
1561
1562
|
ALLOWED_RESOURCES.push("script");
|
|
1562
|
-
|
|
1563
|
-
timeout: REQUEST_TIMEOUT
|
|
1564
|
-
};
|
|
1565
|
-
if (requestUrl === snapshot.url && ctx.config.basicAuthorization) {
|
|
1563
|
+
if (ctx.config.basicAuthorization) {
|
|
1566
1564
|
ctx.log.debug(`Adding basic authorization to the headers for root url`);
|
|
1567
1565
|
let token = Buffer.from(`${ctx.config.basicAuthorization.username}:${ctx.config.basicAuthorization.password}`).toString("base64");
|
|
1568
1566
|
requestOptions.headers = __spreadProps(__spreadValues({}, request.headers()), {
|
|
1569
1567
|
Authorization: `Basic ${token}`
|
|
1570
1568
|
});
|
|
1571
1569
|
}
|
|
1572
|
-
|
|
1573
|
-
|
|
1570
|
+
let response, body;
|
|
1571
|
+
if (requestUrl === snapshot.url) {
|
|
1572
|
+
response = {
|
|
1573
|
+
status: () => 200,
|
|
1574
|
+
headers: () => ({ "content-type": "text/html" })
|
|
1575
|
+
};
|
|
1576
|
+
body = snapshot.dom.html;
|
|
1577
|
+
} else {
|
|
1578
|
+
response = yield page.request.fetch(request, requestOptions);
|
|
1579
|
+
body = yield response.body();
|
|
1580
|
+
}
|
|
1574
1581
|
if (!body) {
|
|
1575
1582
|
ctx.log.debug(`Handling request ${requestUrl}
|
|
1576
1583
|
- skipping no response`);
|