We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
User-Agent
1 parent fbea648 commit 654be4cCopy full SHA for 654be4c
Tests/ClientTests.swift
@@ -403,4 +403,16 @@ class ClientTests: XCTestCase {
403
})
404
waitForExpectationsWithTimeout(expectationTimeout, handler: nil)
405
}
406
+
407
+ func testUserAgentHeader() {
408
+ // Test that the initial value of the header is correct.
409
+ XCTAssert(client.headers["User-Agent"]?.rangeOfString("^Algolia for Swift \\([0-9.]+\\)$", options: .RegularExpressionSearch) != nil)
410
411
+ // Test that changing the user agents results in a proper format.
412
+ client.userAgents = [
413
+ LibraryVersion(name: "ABC", version: "1.2.3"),
414
+ LibraryVersion(name: "DEF", version: "4.5.6")
415
+ ]
416
+ XCTAssertEqual(client.headers["User-Agent"], "ABC (1.2.3); DEF (4.5.6)")
417
+ }
418
0 commit comments