Skip to content
Draft
Changes from 3 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
17 changes: 16 additions & 1 deletion packages/core/src/shared/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/

import crossFetch from 'cross-fetch'
import { getLogger } from './logger'

Check failure on line 7 in packages/core/src/shared/request.ts

View workflow job for this annotation

GitHub Actions / lint (18.x, stable)

do not import from folders or index.ts files since it can cause circular dependencies. import from the file directly
const { HttpsProxyAgent } = require('https-proxy-agent')

const request = {
Copy link
Contributor Author

@Will-ShaoHua Will-ShaoHua Oct 3, 2025

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

suspecting proxy is not applied to the language server download path

Copy link
Contributor Author

Choose a reason for hiding this comment

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

/**
Expand All @@ -23,7 +25,20 @@
params?: RequestParamsArg,
wrappedFetch = crossFetch
): FetchRequest {
return new FetchRequest(url, { ...params, method }, wrappedFetch)
const proxy = process.env.HTTPS_PROXY || process.env.HTTP_PROXY
if (proxy) {
getLogger().info(`detectied proxy being used via env variable and is attaching ${proxy} to userAgent`)
}
const updateParams: any = { ...params }
if (proxy) {
const proxyAgent = new HttpsProxyAgent(proxy)
updateParams.agent = proxyAgent
updateParams.headers = {
...(params?.headers || {}), // ???? do we need this?
}
}

return new FetchRequest(url, { ...updateParams, method }, wrappedFetch)
},
}
export default request
Expand Down
Loading