Thrift-Swift icon indicating copy to clipboard operation
Thrift-Swift copied to clipboard

Swift4.2 -support armeria

Open icoco opened this issue 6 years ago • 1 comments

update THTTPSessionTransport , try support armeria

icoco avatar Aug 02 '19 09:08 icoco

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
    }`

icoco avatar Aug 02 '19 10:08 icoco