From 754859eda86630ae8e56c49d06eb407b5815317f Mon Sep 17 00:00:00 2001 From: daltoniam Date: Mon, 4 Dec 2017 16:04:40 -0600 Subject: [PATCH] updated spec --- CHANGELOG.md | 10 ++++++++++ README.md | 28 ++++++++++++++-------------- Source/Info.plist | 2 +- Source/Operation.swift | 12 ++++++------ Source/Request.swift | 2 +- SwiftHTTP.podspec | 2 +- 6 files changed, 33 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02dbca9..2320f3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. `SwiftHTTP` adheres to [Semantic Versioning](http://semver.org/). +#### [3.0.1](https://github.com/daltoniam/SwiftHTTP/tree/3.0.1) + +fixed: +[#282](https://github.com/daltoniam/SwiftHTTP/pull/282) +[#281](https://github.com/daltoniam/SwiftHTTP/pull/281) +[#280](https://github.com/daltoniam/SwiftHTTP/issues/280) + + +Small bug fixes. + #### [3.0.0](https://github.com/daltoniam/SwiftHTTP/tree/3.0.0) Refactor that has a simpler design. Single framework (no more platform suffixes! e.g. SwiftHTTPOSX, SwiftHTTPTVOS, etc). diff --git a/README.md b/README.md index bf065d7..b377211 100644 --- a/README.md +++ b/README.md @@ -116,9 +116,9 @@ HTTP.GET("https://domain.com", parameters: ["hello": "there"], headers: ["header SSL Pinning is also supported in SwiftHTTP. ```swift -var req = URLRequest(urlString: "https://domain.com") +var req = URLRequest(urlString: "https://domain.com")! req?.timeoutInterval = 5 -let task = HTTP(req!) +let task = HTTP(req) task.security = HTTPSecurity(certs: [HTTPSSLCert(data: data)], usePublicKeys: true) //opt.security = HTTPSecurity() //uses the .cer files in your app's bundle task.run { (response) in @@ -136,9 +136,9 @@ You load either a `Data` blob of your certificate or you can use a `SecKeyRef` i SwiftHTTP supports authentication through [NSURLCredential](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURLCredential_Class/Reference/Reference.html). Currently only Basic Auth and Digest Auth have been tested. ```swift -var req = URLRequest(urlString: "https://domain.com") -req?.timeoutInterval = 5 -let task = HTTP(req!) +var req = URLRequest(urlString: "https://domain.com")! +req.timeoutInterval = 5 +let task = HTTP(req) //the auth closures will continually be called until a successful auth or rejection var attempted = false task.auth = { challenge in @@ -156,9 +156,9 @@ task.run { (response) in Allow all certificates example: ```swift -var req = URLRequest(urlString: "https://domain.com") -req?.timeoutInterval = 5 -let task = HTTP(req!) +var req = URLRequest(urlString: "https://domain.com")! +req.timeoutInterval = 5 +let task = HTTP(req) //the auth closures will continually be called until a successful auth or rejection var attempted = false task.auth = { challenge in @@ -179,18 +179,18 @@ SwiftHTTP also has a simple queue in it! ```swift let queue = HTTPQueue(maxSimultaneousRequest: 2) -var req = URLRequest(urlString: "https://google.com") +var req = URLRequest(urlString: "https://google.com")! req.timeoutInterval = 5 -let task = HTTP(req!) +let task = HTTP(req) task.onFinish = { (response) in print("item in the queue finished: \(response.URL!)") } queue.add(http: task) //the request will start running once added to the queue -var req2 = URLRequest(urlString: "https://apple.com") +var req2 = URLRequest(urlString: "https://apple.com")! req2.timeoutInterval = 5 -let task2 = HTTP(req2!) +let task2 = HTTP(req2) task2.onFinish = { (response) in print("item in the queue finished: \(response.URL!)") } @@ -382,7 +382,7 @@ To use SwiftHTTP in your project add the following 'Podfile' to your project platform :ios, '8.0' use_frameworks! - pod 'SwiftHTTP', '~> 3.0.0' + pod 'SwiftHTTP', '~> 3.0.1' Then run: @@ -404,7 +404,7 @@ $ brew install carthage To integrate SwiftHTTP into your Xcode project using Carthage, specify it in your `Cartfile`: ``` -github "daltoniam/SwiftHTTP" >= 3.0.0 +github "daltoniam/SwiftHTTP" >= 3.0.1 ``` ### Rogue diff --git a/Source/Info.plist b/Source/Info.plist index e0f4bf7..dc2b99a 100644 --- a/Source/Info.plist +++ b/Source/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.0.0 + 3.0.1 CFBundleSignature ???? CFBundleVersion diff --git a/Source/Operation.swift b/Source/Operation.swift index 791e0e6..90e2b41 100644 --- a/Source/Operation.swift +++ b/Source/Operation.swift @@ -211,7 +211,7 @@ open class HTTP { /** Class method to run a GET request that handles the URLRequest and parameter encoding for you. */ - open class func GET(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, + @discardableResult open class func GET(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? { return Run(url, method: .GET, parameters: parameters, headers: headers, requestSerializer: requestSerializer, completionHandler: completionHandler) } @@ -219,28 +219,28 @@ open class HTTP { /** Class method to run a HEAD request that handles the URLRequest and parameter encoding for you. */ - open class func HEAD(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? { + @discardableResult open class func HEAD(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? { return Run(url, method: .HEAD, parameters: parameters, headers: headers, requestSerializer: requestSerializer, completionHandler: completionHandler) } /** Class method to run a DELETE request that handles the URLRequest and parameter encoding for you. */ - open class func DELETE(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? { + @discardableResult open class func DELETE(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? { return Run(url, method: .DELETE, parameters: parameters, headers: headers, requestSerializer: requestSerializer, completionHandler: completionHandler) } /** Class method to run a POST request that handles the URLRequest and parameter encoding for you. */ - open class func POST(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? { + @discardableResult open class func POST(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? { return Run(url, method: .POST, parameters: parameters, headers: headers, requestSerializer: requestSerializer, completionHandler: completionHandler) } /** Class method to run a PUT request that handles the URLRequest and parameter encoding for you. */ - open class func PUT(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, + @discardableResult open class func PUT(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? { return Run(url, method: .PUT, parameters: parameters, headers: headers, requestSerializer: requestSerializer, completionHandler: completionHandler) } @@ -248,7 +248,7 @@ open class HTTP { /** Class method to run a PUT request that handles the URLRequest and parameter encoding for you. */ - open class func PATCH(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? { + @discardableResult open class func PATCH(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? { return Run(url, method: .PATCH, parameters: parameters, headers: headers, requestSerializer: requestSerializer, completionHandler: completionHandler) } diff --git a/Source/Request.swift b/Source/Request.swift index 4aae8ec..6767352 100644 --- a/Source/Request.swift +++ b/Source/Request.swift @@ -233,7 +233,7 @@ extension URLRequest { let queryString = parameters.createPairs(nil).map({ (pair) in return pair.escapedValue }).joined(separator: "&") - if let u = self.url , queryString.characters.count > 0 { + if let u = self.url , queryString.count > 0 { let para = u.query != nil ? "&" : "?" self.url = URL(string: "\(u.absoluteString)\(para)\(queryString)") } diff --git a/SwiftHTTP.podspec b/SwiftHTTP.podspec index 817b58a..3707f9f 100644 --- a/SwiftHTTP.podspec +++ b/SwiftHTTP.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SwiftHTTP" - s.version = "3.0.0" + s.version = "3.0.1" s.summary = "Thin wrapper around NSURLSession in Swift. Simplifies HTTP requests." s.homepage = "https://github.com/daltoniam/SwiftHTTP" s.license = 'Apache License, Version 2.0'