feat: Add optional Accept-Language header configuration #1148
Closed
subhankarmaiti wants to merge 3 commits into
Closed
feat: Add optional Accept-Language header configuration #1148subhankarmaiti wants to merge 3 commits into
subhankarmaiti wants to merge 3 commits into
Conversation
Contributor
Author
|
closing as #1155 is going to solve the same issue |
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
This change introduces an optional configuration setting,
acceptLanguage, allowing developers to specify preferred language tags (e.g., "en-US", "fr-CA,fr;q=0.9") during SDK initialization. When provided, the SDK will automatically include theAccept-LanguageHTTP header with the specified value in all outgoing API requests.Usage Summary:
Developers can now optionally provide an
acceptLanguagestring when initializing the SDK either via theAuth0class constructor or theAuth0Providercomponent prop.If provided, the
Accept-Languageheader will be automatically included in subsequent API calls made by the SDK. This feature is optional and backward compatible; existing initializations withoutacceptLanguagewill continue to function as before. An example has been added toEXAMPLES.md.Testing
src/networking/__tests__/index.spec.jsto verify theClientclass behavior:Accept-Languageheader is not added when theacceptLanguageoption is omitted during initialization.Accept-Languageheader is added with the correct value for GET, POST, and PATCH requests when theacceptLanguageoption is provided.acceptLanguageoption is correctly stored during client initialization.Checklist