algoliasearch-client-javascript
algoliasearch-client-javascript copied to clipboard
fix(recommend): remove the search user-agent from requests [RECO-2154]
What
The createUserAgent function shouldn't set "Algolia for JavaScript" by default. Instead, this agent should be added in the build of the Search client.
Why
The Recommend client uses the same transporter utilities as the Search client, including the createUserAgent function. This causes it to set the
Algolia for JavaScriptuser agent, which corresponds to Algolia Search.
The Recommend client shouldn't send Algolia Search user agents
How
Updated the function createUserAgent to accept an optional base UA as a second parameter. Recommend client can set that to an empty string, while the rest can still use the default value Algolia for JavaScript
If you look at #1507, I thought the conclusion was that "Algolia for JavaScript" isn't a search UA, but just a "JS client UA". Not sure this is needed
Good catch @Haroenv i forgot about the Github issue 👀 i'll convert to draft for now and continue the discussion there.
Same comments as in the issue for me too, the UA is the whole string being sent, Algolia for JavaScript is not scoped to the search client, the following segment defines the current client
And also, this is common to every clients, see https://github.com/algolia/api-clients-automation/blob/main/tests/output/python/tests/client/monitoring_test.py#L27 or https://github.com/algolia/api-clients-automation/blob/main/tests/output/java/src/test/java/com/algolia/client/QuerySuggestions.test.java#L52 and so on