Skip to content

Commit

Permalink
Only append 'Elastic/Synthetics' to default UA
Browse files Browse the repository at this point in the history
When we originally implemented
elastic#232 it appears we didn't
implement the third AC, allowing users to override our custom UA string
"Elastic/Synthetics" which is appended.

Some users need to fully replace the UA, this allows them to do that.
Rather than adding a boolean, this assumes that if you're overriding the
UA you want full control, which is more in line with the principle of
least surprise.
  • Loading branch information
andrewvc authored and vigneshshanmugam committed Jun 3, 2022
1 parent a4c10b5 commit 6f271c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/gatherer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ export class Gatherer {
}

static async getUserAgent(userAgent?: string) {
const syntheticsIdentifier = ' Elastic/Synthetics';
if (!userAgent) {
const session = await Gatherer.browser.newBrowserCDPSession();
({ userAgent } = await session.send('Browser.getVersion'));
return userAgent + ' Elastic/Synthetics';
}
return userAgent + syntheticsIdentifier;
return userAgent;
}

static setNetworkConditions(
Expand Down

0 comments on commit 6f271c7

Please sign in to comment.