Skip to content

Commit 754859e

Browse files
committed
updated spec
1 parent 7aa8b8e commit 754859e

File tree

6 files changed

+33
-23
lines changed

6 files changed

+33
-23
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
All notable changes to this project will be documented in this file.
33
`SwiftHTTP` adheres to [Semantic Versioning](http://semver.org/).
44

5+
#### [3.0.1](https://github.com/daltoniam/SwiftHTTP/tree/3.0.1)
6+
7+
fixed:
8+
[#282](https://github.com/daltoniam/SwiftHTTP/pull/282)
9+
[#281](https://github.com/daltoniam/SwiftHTTP/pull/281)
10+
[#280](https://github.com/daltoniam/SwiftHTTP/issues/280)
11+
12+
13+
Small bug fixes.
14+
515
#### [3.0.0](https://github.com/daltoniam/SwiftHTTP/tree/3.0.0)
616

717
Refactor that has a simpler design. Single framework (no more platform suffixes! e.g. SwiftHTTPOSX, SwiftHTTPTVOS, etc).

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ HTTP.GET("https://domain.com", parameters: ["hello": "there"], headers: ["header
116116
SSL Pinning is also supported in SwiftHTTP.
117117

118118
```swift
119-
var req = URLRequest(urlString: "https://domain.com")
119+
var req = URLRequest(urlString: "https://domain.com")!
120120
req?.timeoutInterval = 5
121-
let task = HTTP(req!)
121+
let task = HTTP(req)
122122
task.security = HTTPSecurity(certs: [HTTPSSLCert(data: data)], usePublicKeys: true)
123123
//opt.security = HTTPSecurity() //uses the .cer files in your app's bundle
124124
task.run { (response) in
@@ -136,9 +136,9 @@ You load either a `Data` blob of your certificate or you can use a `SecKeyRef` i
136136
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.
137137

138138
```swift
139-
var req = URLRequest(urlString: "https://domain.com")
140-
req?.timeoutInterval = 5
141-
let task = HTTP(req!)
139+
var req = URLRequest(urlString: "https://domain.com")!
140+
req.timeoutInterval = 5
141+
let task = HTTP(req)
142142
//the auth closures will continually be called until a successful auth or rejection
143143
var attempted = false
144144
task.auth = { challenge in
@@ -156,9 +156,9 @@ task.run { (response) in
156156
Allow all certificates example:
157157

158158
```swift
159-
var req = URLRequest(urlString: "https://domain.com")
160-
req?.timeoutInterval = 5
161-
let task = HTTP(req!)
159+
var req = URLRequest(urlString: "https://domain.com")!
160+
req.timeoutInterval = 5
161+
let task = HTTP(req)
162162
//the auth closures will continually be called until a successful auth or rejection
163163
var attempted = false
164164
task.auth = { challenge in
@@ -179,18 +179,18 @@ SwiftHTTP also has a simple queue in it!
179179

180180
```swift
181181
let queue = HTTPQueue(maxSimultaneousRequest: 2)
182-
var req = URLRequest(urlString: "https://google.com")
182+
var req = URLRequest(urlString: "https://google.com")!
183183
req.timeoutInterval = 5
184-
let task = HTTP(req!)
184+
let task = HTTP(req)
185185
task.onFinish = { (response) in
186186
print("item in the queue finished: \(response.URL!)")
187187
}
188188
queue.add(http: task) //the request will start running once added to the queue
189189

190190

191-
var req2 = URLRequest(urlString: "https://apple.com")
191+
var req2 = URLRequest(urlString: "https://apple.com")!
192192
req2.timeoutInterval = 5
193-
let task2 = HTTP(req2!)
193+
let task2 = HTTP(req2)
194194
task2.onFinish = { (response) in
195195
print("item in the queue finished: \(response.URL!)")
196196
}
@@ -382,7 +382,7 @@ To use SwiftHTTP in your project add the following 'Podfile' to your project
382382
platform :ios, '8.0'
383383
use_frameworks!
384384

385-
pod 'SwiftHTTP', '~> 3.0.0'
385+
pod 'SwiftHTTP', '~> 3.0.1'
386386

387387
Then run:
388388

@@ -404,7 +404,7 @@ $ brew install carthage
404404
To integrate SwiftHTTP into your Xcode project using Carthage, specify it in your `Cartfile`:
405405

406406
```
407-
github "daltoniam/SwiftHTTP" >= 3.0.0
407+
github "daltoniam/SwiftHTTP" >= 3.0.1
408408
```
409409

410410
### Rogue

Source/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>3.0.0</string>
18+
<string>3.0.1</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

Source/Operation.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,44 +211,44 @@ open class HTTP {
211211
/**
212212
Class method to run a GET request that handles the URLRequest and parameter encoding for you.
213213
*/
214-
open class func GET(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil,
214+
@discardableResult open class func GET(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil,
215215
requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? {
216216
return Run(url, method: .GET, parameters: parameters, headers: headers, requestSerializer: requestSerializer, completionHandler: completionHandler)
217217
}
218218

219219
/**
220220
Class method to run a HEAD request that handles the URLRequest and parameter encoding for you.
221221
*/
222-
open class func HEAD(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? {
222+
@discardableResult open class func HEAD(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? {
223223
return Run(url, method: .HEAD, parameters: parameters, headers: headers, requestSerializer: requestSerializer, completionHandler: completionHandler)
224224
}
225225

226226
/**
227227
Class method to run a DELETE request that handles the URLRequest and parameter encoding for you.
228228
*/
229-
open class func DELETE(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? {
229+
@discardableResult open class func DELETE(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? {
230230
return Run(url, method: .DELETE, parameters: parameters, headers: headers, requestSerializer: requestSerializer, completionHandler: completionHandler)
231231
}
232232

233233
/**
234234
Class method to run a POST request that handles the URLRequest and parameter encoding for you.
235235
*/
236-
open class func POST(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? {
236+
@discardableResult open class func POST(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? {
237237
return Run(url, method: .POST, parameters: parameters, headers: headers, requestSerializer: requestSerializer, completionHandler: completionHandler)
238238
}
239239

240240
/**
241241
Class method to run a PUT request that handles the URLRequest and parameter encoding for you.
242242
*/
243-
open class func PUT(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil,
243+
@discardableResult open class func PUT(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil,
244244
requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? {
245245
return Run(url, method: .PUT, parameters: parameters, headers: headers, requestSerializer: requestSerializer, completionHandler: completionHandler)
246246
}
247247

248248
/**
249249
Class method to run a PUT request that handles the URLRequest and parameter encoding for you.
250250
*/
251-
open class func PATCH(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? {
251+
@discardableResult open class func PATCH(_ url: String, parameters: HTTPParameterProtocol? = nil, headers: [String:String]? = nil, requestSerializer: HTTPSerializeProtocol = HTTPParameterSerializer(), completionHandler: ((Response) -> Void)? = nil) -> HTTP? {
252252
return Run(url, method: .PATCH, parameters: parameters, headers: headers, requestSerializer: requestSerializer, completionHandler: completionHandler)
253253
}
254254

Source/Request.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ extension URLRequest {
233233
let queryString = parameters.createPairs(nil).map({ (pair) in
234234
return pair.escapedValue
235235
}).joined(separator: "&")
236-
if let u = self.url , queryString.characters.count > 0 {
236+
if let u = self.url , queryString.count > 0 {
237237
let para = u.query != nil ? "&" : "?"
238238
self.url = URL(string: "\(u.absoluteString)\(para)\(queryString)")
239239
}

SwiftHTTP.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "SwiftHTTP"
3-
s.version = "3.0.0"
3+
s.version = "3.0.1"
44
s.summary = "Thin wrapper around NSURLSession in Swift. Simplifies HTTP requests."
55
s.homepage = "https://github.com/daltoniam/SwiftHTTP"
66
s.license = 'Apache License, Version 2.0'

0 commit comments

Comments
 (0)