Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add support to load md files via proxy #288

Merged
merged 1 commit into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions markdown-link-check
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const path = require('path');
const pkg = require('./package.json');
const program = require('commander');
const url = require('url');
const { ProxyAgent } = require('proxy-agent');

class Input {
constructor(filenameForOutput, stream, opts) {
Expand Down Expand Up @@ -62,7 +63,9 @@ function getInputs() {
filenameForOutput = filenameOrUrl;
let baseUrl = '';
if (/https?:/.test(filenameOrUrl)) {
stream = needle.get(filenameOrUrl);
stream = needle.get(
filenameOrUrl, { agent: new ProxyAgent(), use_proxy_from_env_var: false }
);
stream.on('error', onError);
stream.on('response', onResponse);
try { // extract baseUrl from supplied URL
Expand Down Expand Up @@ -100,7 +103,7 @@ function getInputs() {
if (config) {
input.opts.config = config.trim();
}

if (program.projectBaseUrl) {
input.opts.projectBaseUrl = `file://${program.projectBaseUrl}`;
} else {
Expand Down
Loading