feat: support custom fetch implementation via option - #40
Merged
Conversation
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/jestThe overall coverage remains at 67%, unchanged from the Updated |
titan-ron
force-pushed
the
titan/fetch-override-option
branch
from
July 19, 2026 22:58
b2b92d6 to
14ba25d
Compare
titan-ron
force-pushed
the
titan/fetch-override-option
branch
from
July 19, 2026 23:12
14ba25d to
71ed7c0
Compare
|
🎉 This PR is included in version 1.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Summary
Adds support for overriding the
fetchfunction via a client option. Callers can now inject a customfetchimplementation (for proxies, custom agents, retries, non-Node runtimes, or testing). Defaults to the globalfetchwhen not provided.Changes
src/lib/types.ts: addFetchFunctiontype alias and an optionalfetchfield onCreateClientOptions.src/lib/sonar-client.ts: thread the customfetchthroughcreateClientandSonarQubeClient, usingglobalThis.fetch.bind(globalThis)as the default.request()now callsthis.fetchFn.src/lib/sonar-client.spec.ts: new test asserting the customfetchmock is used (URL/method/headers) and the global fetch is not.README.md: document the newfetchoption.Validation
npm run lint:check✓npm run format:check✓npm test✓ (14 passed)npm run build✓