question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Track1] User Agent Can be Override

See original GitHub issue

I do a test to try to override the Use-Agent in Track1 JS SDK, and it succeed. The Following is the details: Codes:

const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
const { ComputeManagementClient } = require("@azure/arm-compute");

msRestNodeAuth.interactiveLogin().then((creds: any) => {
    const client = new ComputeManagementClient(creds, "eece696d-f03b-47a5-9e4c-157d7ad85b20", {
        userAgent: "aaaaaaaaaaaaaaaaaaaaaaaa"
    });
    client.operations.list().then((result: any) => {
        console.log("The result is:");
        console.log(result);
    });
}).catch((err: any) => {
    console.error(err);
});

Requests Header captured by fiddler:

image

I think the user-agent should only be extended, instead of overrode. Please check it.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sarangan12commented, Jun 14, 2021

Code complete with PR https://github.com/Azure/autorest.typescript/pull/1033. Will be released tomorrow (06/15)

1reaction
sarangan12commented, Jun 8, 2021

I have synched up with other SDK owners and confirmed that they are infact appending the user provided user-agent value (prepending in case of Track 2). So, I have to do the same for Track 1 & Track 2 SDK Generators.

For Track 1 SDK Generator, I am planning to use the user-agent value in the following format: azure-sdk-for-js/<package_name>/<package_version> ms-rest-js/<package_version><platform_info>. An example User-Agent String will be azure-sdk-for-js/@azure/arm-compute/11.2.0 ms-rest-js/10.0.0 (Ubuntu; Linux x86_64; rv:34.0). To this, the user provided value will be appended.

[Note: There is already a default user agent in ms-rest-js. But, that has only ms-rest-js/<version>/<platformspecificdata> which is not sufficient. The above format, that I suggested was based on the Python’s recommendation as mentioned here]

For Track 2, the situation is similar to Track 1 in case of core-http. Once, I complete the implementation, I will update this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Network conditions: Override the user agent string
To override the user agent string from Chrome DevTools: Press Command + Shift + P (Mac) or Control + Shift + P (Windows,...
Read more >
Override User Agent in Google Analytics (analytics.js)
Hi there,. I try to map my own user agent parameter to the Google Analytics tag (analytics.js). But I cannot get it to...
Read more >
Re: Gimp EPS not working in \epsfile - GNU mailing lists - GNU.org
User -agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 ... I can repeat your error, but leave it to others who know...
Read more >
how to override user agent CSS - Stack Overflow
From the looks of it, you are trying to apply the list-style-type property to a span-element, according to this selector span.form-error .
Read more >
just_audio 0.6.14+1 | Flutter Package - Pub.dev
final player = AudioPlayer( userAgent: 'myradioapp/1.0 (Linux;Android 11) ... Playback will be prepared to start from track1.mp3 initialIndex: 0, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found