-
Notifications
You must be signed in to change notification settings - Fork 21
Update core User-Agent logic #12
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
Conversation
…ot supplied by an outside SDK
@padamstx this should be ready for a re-review |
@@ -153,6 +153,9 @@ | |||
*/ | |||
String WWW_AUTHENTICATE = "WWW-Authenticate"; | |||
|
|||
/** Header containing analytics info. */ | |||
String X_IBMCLOUD_SDK_ANALYTICS = "X-IBMCloud-SDK-Analytics"; | |||
|
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.
It doesn't seem right that a watson-specific header name is defined inside the core. At least I think this sdk analytics stuff is watson-specific. Anyway, it's not a showstopper or anything, but just seems a little odd is all.
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.
That's a good call actually. I'll move that out into the Watson SDK and make a point to get rid of other Watson-specific things in a later PR.
This reverts commit 190af0e.
This PR updates the logic regarding the
User-Agent
header.getUserAgent()
now returns the core-specific information, which is the core package version and the various OS and Java versions. This can be called from SDKs that pull in the core as a dependency.This PR also ensures that, if the
User-Agent
isn't set on a request, the core info is sent as theUser-Agent
, so that something is always passed with the request.In the Java SDK, the method to set the
User-Agent
will look like this:This will result in something like the following: