Add the OS to the User-Agent header, as in Macintosh or iOS.
This commit is contained in:
parent
d093bf9a21
commit
f4b33c6afb
|
@ -18,7 +18,14 @@ public struct UserAgent {
|
||||||
guard let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") else {
|
guard let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") else {
|
||||||
return nil
|
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]? {
|
public static func headers() -> [AnyHashable: String]? {
|
||||||
|
|
Loading…
Reference in New Issue