Skip to content

Commit 3615150

Browse files
committed
fix(clients): correct user agent
1 parent dd18afe commit 3615150

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

clients/algoliasearch-client-dart/packages/client_core/lib/src/transport/dio/platform/platform_web.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ Iterable<AgentSegment> platformAgentSegments() => [
1313

1414
/// [AlgoliaAgent] for web platforms as query param.
1515
void platformAlgoliaAgent(dio.RequestOptions options, String agent) {
16-
options.queryParameters["X-Algolia-Agent"] = agent;
16+
options.queryParameters["x-algolia-agent"] = agent;
1717
}

clients/algoliasearch-client-swift/Sources/Core/Networking/RequestBuilder/EchoRequestBuilder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ final class EchoRequestBuilder: RequestBuilder {
7878
originalBodyData: urlRequest.httpBody,
7979
path: urlComponents?.percentEncodedPath ?? "",
8080
host: url.host ?? "",
81-
algoliaAgent: headers["X-Algolia-Agent"] ?? "",
81+
algoliaAgent: headers["user-agent"] ?? "",
8282
queryParameters: queryParameters,
8383
headers: headers
8484
)

website/docs/add-new-language.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ The `User-Agent` MUST match the following regular expression:
110110
^Algolia for <LANGUAGE> \\(\\d+\\.\\d+\\.\\d+(-?.*)?\\)(; [a-zA-Z. ]+ (\\(\\d+((\\.\\d+)?\\.\\d+)?(-?.*)?\\))?)*(; <CLIENT> (\\(\\d+\\.\\d+\\.\\d+(-?.*)?\\)))(; [a-zA-Z. ]+ (\\(\\d+((\\.\\d+)?\\.\\d+)?(-?.*)?\\))?)*$
111111
```
112112

113-
The function MUST be named `addAlgoliaAgent` because of JavaScript exception that doesn't allow custom `User-Agent` in the header, and must use `x-algolia-agent` for JavaScript.
113+
The function MUST be named `addAlgoliaAgent` because of JavaScript exception that doesn't allow custom `User-Agent` in the header, and must use `x-algolia-agent` for JavaScript and Dart.
114114

115115
### Dependencies
116116

0 commit comments

Comments
 (0)