Thrift-Swift
Thrift-Swift copied to clipboard
Swift4.2 -support armeria
try support armeria:
add method buildSessionConfiguration to file THTTPSessionTransport
` //support define protoal key name from outside and force return the config public class func buildSessionConfiguration(_ config: URLSessionConfiguration, withProtocolNameValue protocolNameValue: String?, _ protocolNameKey:String = "protocol")->URLSessionConfiguration { var thriftContentType = "application/x-thrift"
if let protocolNameValue = protocolNameValue {
thriftContentType += "; \(protocolNameKey)=\(protocolNameValue)"
}
config.requestCachePolicy = .reloadIgnoringLocalCacheData
config.urlCache = nil
config.httpShouldUsePipelining = true
config.httpShouldSetCookies = true
config.httpAdditionalHeaders = ["Content-Type": thriftContentType,
"Accept": thriftContentType,
"User-Agent": "Thrift/Swift (Session)"]
return config
}`