Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ async function get(hostname, path) {
hostname,
path,
method: "GET",
// Add a referrer header to avoid 403 errors
headers: {
Referer: `https://${hostname}/`,
},
Comment on lines +28 to +30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Adding the Referer header is a good solution to avoid 403 errors. However, this change breaks the existing unit tests in test/cli.test.js. The test case 'get function should make HTTPS requests' now fails because its assertion on https.request doesn't expect the headers object. Please update the test to include an expectation for this new header to ensure the test suite passes and properly covers this new behavior.

},
(res) => {
const body = [];
Expand Down