Repository navigation
fix(node): send Node requests through the shared Fetch transport - #46
Merged
Merged
Conversation
NodeAdapter overrode request() with (method, url) while the inherited get() calls request(path, 'GET', ...), so every GET under Node went to '/<ns>/GET' with the path as its method. It also read the constructor-time config, so headers set later with setHeaders (Customer-Token, Accept-Language) and host changes were dropped. NodeAdapter now only adds its User-Agent and inherits the browser transport.
This was referenced Oct 8, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v2.1.0 #46 +/- ##
================================================
Coverage 100.00% 100.00%
================================================
Files 17 17
Lines 866 855 -11
Branches 144 143 -1
================================================
- Hits 866 855 -11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Problem
In v2.0.0,
NodeAdapteroverridesrequest(method, url, options), but the inheritedget()callsrequest(path, 'GET', {}, options). Under Node, every GET therefore went to<host>/<namespace>/GET, with the path sent as the HTTP method.NodeAdapteralso read its constructor-time config, so headers added later withsetHeaders(such asCustomer-TokenandAccept-Language) and host changes were dropped.The existing test called each verb but didn't check the URL, method or headers, so it didn't catch this. Browsers and React Native use
BrowserAdapterand were not affected. Node consumers were, and that includes the Storefront SDK once it depends on this package.Fix
NodeAdapternow only adds itsUser-Agentheader and inherits the browser Fetch transport. Every verb, the current host and namespace, and headers set later now behave the same as inBrowserAdapter.Tests
Authorization,setHeadersand per-request headers plus the NodeUser-Agent.main, with the GET going tohttps://api.test/v1/GET, and passes with this change.release/v2.1.0.