feat(codegen): add AbortSignal and per-request headers to NodeHttpAdapter#743
Merged
pyramation merged 1 commit intomainfrom Feb 26, 2026
Merged
Conversation
…pter - Add optional AbortSignal support to makeRequest() for request cancellation (early reject if already aborted, destroy request on abort event, clean up listener on close) - Add NodeHttpExecuteOptions interface with headers and signal fields - Add optional options parameter to NodeHttpAdapter.execute() for per-request header overrides and AbortSignal - These additions are backward-compatible (all new parameters are optional) and extend beyond the base GraphQLAdapter interface
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
feat(codegen): add AbortSignal and per-request headers to NodeHttpAdapter
Summary
Adds two capabilities to
NodeHttpAdapterin the codegennode-fetch.tstemplate that were present in the oldbrowserCompatible=falseimplementation but missing from the current adapter:node:httprequests (important for CLI Ctrl+C and React Query component unmount).execute()call without mutating the adapter instance.Both are exposed via a new optional
NodeHttpExecuteOptionsparameter onexecute(). The baseGraphQLAdapterinterface is not changed — the extra optional parameter is backward-compatible.Changes are confined to a single template file (
node-fetch.ts) that is copied verbatim into generated output at codegen time.Review & Testing Checklist for Human
execute()signature stays compatible withGraphQLAdapterinterface — the third optional param should not break assignability, but confirm TypeScript is happy in a generated project that usesNodeHttpAdapteras aGraphQLAdapter.req.on('close')removes the abort listener. On abort,req.destroy()triggersclosewhich also cleans up. Confirm no leak path exists (e.g., if the promise rejects before the request is created).nodeHttpAdapter: trueand verify the output compiles and the new options work at runtime.Notes
node-fetch.ts) is excluded from the codegen package's owntsconfig.json, so package-leveltscwill not catch type errors in this file.NodeHttpAdapterby consuming applications.eslint.config.jsfor ESLint v9); unrelated to this change.Link to Devin run: https://app.devin.ai/sessions/73d9c02182a240e3857850d776bad754
Requested by: @pyramation