fix: wrong content type for batch-analysis#429
Merged
ruromero merged 1 commit intoguacsec:mainfrom Mar 24, 2026
Merged
Conversation
Signed-off-by: Ruben Romero Montes <rromerom@redhat.com>
ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan Review Summary by QodoFix incorrect Content-Type header for batch-analysis API
WalkthroughsDescription• Define CYCLONEDX_JSON_MEDIA_TYPE constant for batch-analysis API • Fix incorrect Content-Type header in requestStackBatch function • Standardize Content-Type usage across batch and image analysis endpoints • Add comprehensive test coverage for Content-Type validation Diagramflowchart LR
A["Define CYCLONEDX_JSON_MEDIA_TYPE<br/>constant"] --> B["Update requestStackBatch<br/>Content-Type header"]
A --> C["Update requestImages<br/>Content-Type header"]
B --> D["Add test validation<br/>for Content-Type"]
C --> D
File Changes1. src/analysis.js
|
Code Review by Qodo
1. Proxy config ignored
|
Strum355
approved these changes
Mar 24, 2026
Comment on lines
211
to
217
| method: 'POST', | ||
| headers: { | ||
| 'Accept': html ? 'text/html' : 'application/json', | ||
| 'Content-Type': 'application/vnd.cyclonedx+json', | ||
| 'Content-Type': CYCLONEDX_JSON_MEDIA_TYPE, | ||
| ...getTokenHeaders(opts) | ||
| }, | ||
| body: JSON.stringify(imageSboms), |
There was a problem hiding this comment.
1. Proxy config ignored 🐞 Bug ⛯ Reliability
requestImages() sends the batch-analysis request via fetch() without addProxyAgent(...), so TRUSTIFY_DA_PROXY_URL is ignored for image analysis requests and can fail in proxied environments.
Agent Prompt
## Issue description
`requestImages()` bypasses proxy configuration because it calls `fetch()` directly instead of wrapping request init with `addProxyAgent(...)`. This causes image analysis requests to ignore `TRUSTIFY_DA_PROXY_URL`.
## Issue Context
Other outbound requests in `src/analysis.js` (e.g., `requestStackBatch`) consistently wrap options via `addProxyAgent(options, opts)` so proxy settings apply.
## Fix Focus Areas
- src/analysis.js[198-218]
- src/tools.js[182-194]
## Suggested change
In `requestImages()`, build a `fetchOptions` object identical to the current inline object, wrap it with `addProxyAgent(fetchOptions, opts)`, and pass the wrapped options to `fetch(finalUrl, wrappedOptions)` (mirroring `requestStackBatch`). Ensure headers/body stay the same.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Incorrect content-type for batch analysis
Related issues (if any):
Checklist