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
Set User-Agent
in http.Client
used in govmomi lib
#2693
Comments
Example (adopted from // file: version.go
package govmomi
// SDKName is the name of this library
const LibraryName = "govmomi"
// SDKVersion is the version of the library
const LibraryVersion = "0.28.0" Source: https://github.com/aws/aws-sdk-go/blob/main/aws/version.go @dougm thoughts? |
When/how would the automation update the Another option might be to update But I'm good with adopting a common pattern from what other projects are doing these days. |
My idea: create a
Thought about manual way too, but this would require someone to file a PR (since we don't directly push to |
That sounds cool. Maybe someday I'll learn more about GH Actions, in the meantime thanks for all your efforts around this!
True, in the old days I would bump the const version as part of the PR for release docs update (usage, changelog, contributors, etc). Would be much better to automate the version bump. |
Question (likely from ignorance): Once this feature is developed/implemented, will it block setting a more specific user agent? Snippet from a project where I'm using this library: c, err := govmomi.NewClient(ctx, u, trustCert)
if err != nil {
return nil, err
}
// Override default user agent
c.Client.UserAgent = userAgent
// provide credentials *after* we create the client so that the desired
// User Agent value can be set before logging in.
u.User = url.UserPassword(username, password)
// Login, supplying our custom user agent in place of the default
authErr := c.Login(ctx, u.User)
if authErr != nil {
return nil, authErr
} where:
|
Thx for the great feedback @atc0005 ! This is really useful and my plan was to definitely allow for customization/overwriting the |
This issue is stale because it has been open for 90 days with no |
/remove-lifecycle stale |
Closes: vmware#2693 Signed-off-by: Michael Gasch <mgasch@vmware.com>
Closes: vmware#2693 Signed-off-by: Michael Gasch <mgasch@vmware.com>
Closes: vmware#2693 Signed-off-by: Michael Gasch <mgasch@vmware.com>
Closes: vmware#2693 Signed-off-by: Michael Gasch <mgasch@vmware.com>
Is your feature request related to a problem? Please describe.
Set a default value for
User-Agent
inhttp.Client
when using the library (govc
already allows this) to identify requests coming fromgovmomi
SDK (currently it only shows a generic Go client in stats). Useful for debugging, statistics, etc.Describe the solution you'd like
Set a default value for
User-Agent
inhttp.Client
govmomi/vim25/soap/client.go
Line 75 in 59582c4
Describe alternatives you've considered
Keep as is
Additional context
Should not be considered a breaking change IMHO?
The text was updated successfully, but these errors were encountered: