fix: forward plain-string headers to token fetch request - #1392
Open
ankita10119 wants to merge 3 commits into
Open
fix: forward plain-string headers to token fetch request#1392ankita10119 wants to merge 3 commits into
ankita10119 wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1392 +/- ##
=======================================
Coverage 89.73% 89.73%
=======================================
Files 441 441
Lines 20799 20799
Branches 10146 10146
=======================================
Hits 18663 18663
Misses 2136 2136
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
ankita10119
marked this pull request as draft
August 19, 2026 15:07
ankita10119
marked this pull request as ready for review
August 20, 2026 10:09
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.
Changes
What: Custom headers passed to
ManagementClient(e.g.User-Agent) were not being forwarded to the internalPOST /oauth/tokentoken fetch request. They only appeared on subsequent Management API calls.Why:
TokenProviderconstructedAuthenticationClientwithheaders: undefined, explicitly discarding all user-supplied headers. This was not intentional - the line was introduced in the initial v5 setup with no documented reason.Fix:
TokenProvidernow extracts plain string headers fromoptions.headersand forwards them toAuthenticationClient, so custom headers are consistently present on all outgoing requests including the token fetch.Note: Only plain string header values are forwarded. Supplier functions (Fern's
Record<string, Supplier<...>>type) are silently filtered out, asAuthenticationClientdoes not support async/dynamic header resolution.No public API changes - this is a bug fix with no breaking changes.
References
User-Agentheader not sent on first request when usingclientId + clientSecretwithManagementClientTesting
User-Agent) are present on thePOST /oauth/tokenrequest using nock'smatchHeaderChecklist