Closed kduffie closed 3 years ago
I don't remember details, but there were some issues when passing src
as separate param. Not ready to suggest good fix for such case.
IMO, it would be more simple for you to replace probe.http with your custom http wrapper - that's very small peace of code.
Close: wantfix / switched to needle
This works great until I try to add an agent to the options so that I can use this through a proxy.
const options = { agent: new HttpsProxyAgent(proxyUrl) }; const result = await probe(imageUrl, options);
I've traced this through the code. The first problem is that when you merge the options with default options, you also merge that with the URL, and this causes an immediate problem. But if I change your code so that line 34 of http.js becomes:
stream = request(src, merge.all([default, options]));
That allows my options to make it through. The problem then appears on line 751 of request.js:
self.req = self.httpModule.request(reqOptions)
At this point, I can see the that reqOptions object appears to be correct. It has an "agent" member that is an object and looks right. But this always throws an error saying,
"The "options.agent" property must be one of Agent-like Object, undefined, or false. Received an instance of Object"
I can pass this same agent object into node-fetch as an option and it works correctly.
I'm using 2.88.2 of the request package in node v12.16.2. This is probe-image-size v5.0.0.