Skip to content

Commit 8fd6556

Browse files
feat: addition of cookies and basic auth - 7
1 parent 4e78f0d commit 8fd6556

File tree

4 files changed

+9
-43
lines changed

4 files changed

+9
-43
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
"form-data": "^4.0.0",
3939
"listr2": "^7.0.1",
4040
"mime-types": "^2.1.35",
41-
"node-fetch": "2",
4241
"sharp": "^0.33.4",
4342
"tsup": "^7.2.0",
4443
"which": "^4.0.0",

pnpm-lock.yaml

Lines changed: 0 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/processSnapshot.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { chromium, Locator } from "@playwright/test"
44
import constants from "./constants.js";
55
import { updateLogContext } from '../lib/logger.js'
66
import mime from 'mime-types';
7-
import fetch from 'node-fetch';
7+
import axios from "axios";
88

99
const MAX_RESOURCE_SIZE = 15 * (1024 ** 2); // 15MB
1010
var ALLOWED_RESOURCES = ['document', 'stylesheet', 'image', 'media', 'font', 'other'];
@@ -16,13 +16,14 @@ async function makeDirectRequest(request, username, password) {
1616
let headers = { ...request.headers() };
1717
let token = Buffer.from(`${username}:${password}`).toString('base64');
1818
headers.Authorization = `Basic ${token}`;
19-
20-
const response = await fetch(request.url(), {
21-
method: request.method(),
22-
headers: headers,
19+
20+
const response = await axios({
21+
method: request.method(),
22+
headers: headers,
23+
responseType: 'arraybuffer',
2324
});
2425

25-
return response.arrayBuffer();
26+
return response.data;
2627
}
2728

2829
export default class Queue {

src/lib/schemaValidation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ const ConfigSchema = {
139139
properties: {
140140
username: {
141141
type: "string",
142-
errorMessage: "username is mandatory"
142+
errorMessage: "Invalid config; username is mandatory"
143143
},
144144
password: {
145145
type: "string",
146-
errorMessage: "password is mandatory"
146+
errorMessage: "Invalid config; password is mandatory"
147147
},
148148
}
149149
}

0 commit comments

Comments
 (0)