Skip to content

No proxy detected/used + Authentication #6

@LeM0-Dev

Description

@LeM0-Dev
const fetch = require("fetch-with-proxy");

=> TypeError: fetch is not a function

using

const fetch = require("fetch-with-proxy").default;

=> Works but doesnt use proxy even when set.

my code:

const fetch = require("fetch-with-proxy").default;
process.env.HTTPS_PROXY = "myproxyprovider:port";
fetch("http://www.mikes-marketing-tools.com/whatismyip.php", {
	"authenticate":{
		"username": "myusername",
		"password": "mypassword"
	},
  "headers": {
    "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
    "accept-language": "en,en-US;q=0.9,cs;q=0.8,sk-SK;q=0.7,sk;q=0.6",
    "cache-control": "no-cache",
    "pragma": "no-cache",
    "sec-fetch-dest": "document",
    "sec-fetch-mode": "navigate",
    "sec-fetch-site": "same-origin",
    "sec-fetch-user": "?1",
    "sec-gpc": "1",
    "upgrade-insecure-requests": "1"
  },
  "referrer": "http://www.mikes-marketing-tools.com/whatismyip.php",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": null,
  "method": "GET",
  "mode": "cors",
  "credentials": "include"
}).then(function (response) {
	return response.text();
}).then(function (html) {
	parser = new DOMParser();
	doc = parser.parseFromString(html, 'text/html');
	fs.appendFile('./content.html', doc.rawHTML, function(err){
		if (err) return console.log(err);
		console.log("LOADED");
	})

}).catch(function (err) {
	console.warn('Something went wrong.', err);
});

I am not sure if the authentication is handled correctly and generally the documentation and readme doesnt tell us much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions