Skip to content

Commit 1a6c3a7

Browse files
ruromeroclaude
andcommitted
fix: add missing proxy support to requestImages() and restore analysis tests
Add addProxyAgent() call to requestImages(), which was the only request function missing proxy support. Restore and fix all analysis tests that were excluded from CI via --grep --invert: migrate MSW v1 to v2 API, fix stale header/option names (ex-provider-1-token → trust-da-token), add temp file setup for requestStack/requestComponent tests, and add addProxyAgent unit tests with actual agent verification. Implements TC-3922 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fb7d0e3 commit 1a6c3a7

3 files changed

Lines changed: 149 additions & 109 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"lint": "eslint src test --ext js",
3939
"lint:fix": "eslint src test --ext js --fix",
4040
"test": "c8 npm run tests",
41-
"tests": "mocha --config .mocharc.json --grep \".*analysis module.*\" --invert",
41+
"tests": "mocha --config .mocharc.json",
4242
"tests:rep": "mocha --reporter-option maxDiffSize=0 --reporter json > unit-tests-result.json",
4343
"pretest": "cp node_modules/tree-sitter-requirements/tree-sitter-requirements.wasm src/providers/tree-sitter-requirements.wasm && cp node_modules/tree-sitter-gomod/tree-sitter-gomod.wasm src/providers/tree-sitter-gomod.wasm",
4444
"precompile": "rm -rf dist",

src/analysis.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,17 @@ async function requestImages(imageRefs, url, html = false, opts = {}) {
207207
finalUrl.searchParams.append('recommend', 'false');
208208
}
209209

210-
const resp = await fetch(finalUrl, {
210+
const fetchOptions = addProxyAgent({
211211
method: 'POST',
212212
headers: {
213213
'Accept': html ? 'text/html' : 'application/json',
214214
'Content-Type': CYCLONEDX_JSON_MEDIA_TYPE,
215215
...getTokenHeaders(opts)
216216
},
217217
body: JSON.stringify(imageSboms),
218-
})
218+
}, opts)
219+
220+
const resp = await fetch(finalUrl, fetchOptions)
219221

220222
if (resp.status === 200) {
221223
let result;

0 commit comments

Comments
 (0)