Add the OS to the User-Agent header, as in Macintosh or iOS.

This commit is contained in:
Brent Simmons 2017-12-30 11:23:35 -08:00
parent d093bf9a21
commit f4b33c6afb
1 changed files with 8 additions and 1 deletions

View File

@ -18,7 +18,14 @@ public struct UserAgent {
guard let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") else {
return nil
}
return "\(userAgentName) \(version)"
#if os(macOS)
let osString = "Macintosh"
#elseif os(iOS)
let osString = "iOS"
#endif
return "\(userAgentName)/\(version) (\(osString))"
}
public static func headers() -> [AnyHashable: String]? {