Azure / azure-cosmosdb-node

We recently announced deprecation of JS v1 SDK and this repo. Starting September 2020 Microsoft will not provide support for this library. Existing applications using library will continue to work as-is. We strongly recommend upgrading to @azure/cosmos library.
https://github.com/Azure/azure-sdk-for-js
MIT License
141 stars 108 forks source link

Need way to set/add to user agent #244

Closed StephenWeatherford closed 6 years ago

StephenWeatherford commented 6 years ago

(I don't think this is the same request as #234)

I need a way to set the user-agent for the document client. Right now I can do this by modifying defaultHeaders directly on the client, but this isn't exposed in the Typescript definition, so I'm not sure if it just needs to be added, or if this would be relying on internal implementation details. Thanks.

srinathnarayanan commented 6 years ago

@christopheranderson can you please take a look at this? Thanks.

christopheranderson commented 6 years ago

The way to do this today is to set it on the documentClient after it is created (aka monkey patch).

const client = new DocumentClient(...);
client.requestAgent = new https.Agent(...);

In the next version of the SDK, https://github.com/azure/azure-cosmos-js, this will be available in the constructor so you don't have to monkey patch.