Skip to content

Commit f672e40

Browse files
committed
Add support to load md files via proxy
1 parent 1a5a675 commit f672e40

File tree

3 files changed

+776
-36
lines changed

3 files changed

+776
-36
lines changed

markdown-link-check

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const path = require('path');
1010
const pkg = require('./package.json');
1111
const program = require('commander');
1212
const url = require('url');
13+
const { ProxyAgent } = require('proxy-agent');
1314

1415
class Input {
1516
constructor(filenameForOutput, stream, opts) {
@@ -62,7 +63,9 @@ function getInputs() {
6263
filenameForOutput = filenameOrUrl;
6364
let baseUrl = '';
6465
if (/https?:/.test(filenameOrUrl)) {
65-
stream = needle.get(filenameOrUrl);
66+
stream = needle.get(
67+
filenameOrUrl, { agent: new ProxyAgent(), use_proxy_from_env_var: false }
68+
);
6669
stream.on('error', onError);
6770
stream.on('response', onResponse);
6871
try { // extract baseUrl from supplied URL
@@ -100,7 +103,7 @@ function getInputs() {
100103
if (config) {
101104
input.opts.config = config.trim();
102105
}
103-
106+
104107
if (program.projectBaseUrl) {
105108
input.opts.projectBaseUrl = `file://${program.projectBaseUrl}`;
106109
} else {

0 commit comments

Comments
 (0)