Skip to content
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

GeneratedClient constructor should not mutate the options bag #1039

Closed
jeremymeng opened this issue Jun 17, 2021 · 1 comment
Closed

GeneratedClient constructor should not mutate the options bag #1039

jeremymeng opened this issue Jun 17, 2021 · 1 comment
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. v6
Milestone

Comments

@jeremymeng
Copy link
Contributor

my convenience layer code creates two clients using the same options bag:

     const authClient = new GeneratedClient(endpoint, internalPipelineOptions);
     this.client = new GeneratedClient(endpoint, internalPipelineOptions);

It leads to duplicate library infor in user-agent header for the second client because the generated client's constructor updated options.userAgentOptions.userAgentPrefix. I fixed it by

-    options.userAgentOptions = {
-      userAgentPrefix: userAgentPrefix
-    };
-
     const optionsWithDefaults = {
       ...defaults,
       ...options,
+      userAgentOptions: {
+        userAgentPrefix
+      },
       baseUri: options.endpoint || "{url}"
     };
@sarangan12 sarangan12 added this to the [2021] July milestone Jun 17, 2021
@sarangan12 sarangan12 added bug This issue requires a change to an existing behavior in the product in order to be resolved. v6 labels Jun 17, 2021
@sarangan12
Copy link
Member

Code complete with #1042. Will be included in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. v6
Projects
None yet
Development

No branches or pull requests

2 participants