-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RED-2503][RED-2506][RED-2507][RED-2509] Add zaf_sdk user agent to headers for requests #220
base: master
Are you sure you want to change the base?
Conversation
- To assist with debugging the source of various requests it would be helpful to indicate whether requests have been touched by the zaf_sdk at any point - This will help operationally for various things that need to be done to monitor things of an api related nature - Knowing that a request has been touched by zaf_sdk helps to pinpoint the source + narrow down where things need fixing and/or patching - It would be good to get the appId too but this is a good first port of call
3bb3748
to
3a9251d
Compare
- Let's ensure that we know which app made a given request by encoding within the user-agent - This will help /w ascertaining who is making a given request
1e24b30
to
091e70b
Compare
lib/utils.js
Outdated
const Promise = window.Promise || NativePromise | ||
|
||
export function addUserAgent (headers, appId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add a test for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actioned with this commit 23e6df8 , thanks for keeping my pull requests honest 😅
FYI: looks like you need to complete the Tasks too. |
const Promise = window.Promise || NativePromise | ||
|
||
export function addUserAgent (headers, appId) { | ||
const originalUserAgent = headers && headers['User-Agent'] ? headers['User-Agent'] : '' | ||
const zafSdkUserAgentString = `zendesk_app_framework_sdk/sdk_version:${pkgJson.version}/app_id:${appId}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reckon the version in pkgJson doesn't reflect the actual version, this PR didn't touch on the version as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Sheen, should I remove this? Note that I've bumped the version in package.json in this commit but I can remove if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reckon when customer refer to zaf_sdk in their app, it is using the release version now. So this version is unrelavant unless we can manually keep align with the release version.
With regarding to shall we keep this, as reviewing the purpose of this PR, wonder do you need this info for internal debug only? In that case, probably considering adding x-zendesk-app-framework-sdk-version header for this instead of chain the existing user agent? As all x-zendesk-
headers will be filtered(unless in allowlist) out before zendesk proxy dispatch the request, so it will have zero customer impact and in the meantime, internal can still track the zaf-sdk version in the log
- Rename to updateUserAgentWithAppId - Bump version - Add tests for updateUserAgentWithAppId
7fab0d4
to
1c88245
Compare
✌️
/cc @zendesk/vegemite
Description
Tasks
References
DevQA Steps
NOTE: DevQA steps are to be actioned only once code has been reviewed and approved.
Risks
Rollback Plan