Fix customHeaders being ignored by the primary runAction request path - #429
Open
nouraellm wants to merge 1 commit into
Open
Fix customHeaders being ignored by the primary runAction request path#429nouraellm wants to merge 1 commit into
nouraellm wants to merge 1 commit into
Conversation
## Summary customHeaders passed to the Airtable constructor were only applied when using the lower-level base.makeRequest() method. All high-level table/record methods (select, create, update, replace, destroy, find, etc.) go through the older runAction path, which hard-coded headers and completely ignored _customHeaders. This PR fixes that by making run_action.ts use the existing _getRequestHeaders() helper (the same one makeRequest already uses). ## Changes - Updated src/run_action.ts to call base._getRequestHeaders() instead of hardcoding headers - Preserved the two extra headers (x-api-version and x-airtable-application-id) that the old path was sending - Removed now-unused packageVersion import and userAgent constant - Custom headers are now correctly applied on every request made by the library ## Related issue Fixes Airtable#428
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
customHeaderspassed to theAirtableconstructor were only applied when using the lower-levelbase.makeRequest()method. All high-level table/record methods (select,create,update,replace,destroy,find, etc.) go through the olderrunActionpath, which hard-coded headers and completely ignored_customHeaders.This PR fixes that by making
run_action.tsuse the existing_getRequestHeaders()helper (the same onemakeRequestalready uses).Changes
src/run_action.tsto callbase._getRequestHeaders()instead of hardcoding headersx-api-versionandx-airtable-application-id) that the old path was sendingpackageVersionimport anduserAgentconstantRelated issue
Fixes #428