Skip to content

Commit

Permalink
Merge pull request #7 from tomohisa/master
Browse files Browse the repository at this point in the history
'upgrade' name conflict

  • Loading branch information
tomohisa committed May 2, 2016
2 parents 4f2280d + 0e6cce9 commit 9b2010e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Source/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ extension Client {
let data = try connection.receive(upTo: 1024)
if let response = try parser.parse(data) {

if let upgrade = request.upgrade {
if let upgrade = request.didUpgrade {
try upgrade(response, connection)
}

Expand Down Expand Up @@ -202,24 +202,24 @@ extension Request {
}
}

typealias Upgrade = (Response, Stream) throws -> Void
typealias DidUpgrade = (Response, Stream) throws -> Void

// Warning: The storage key has to be in sync with Zewo.HTTP's upgrade property.
var upgrade: Upgrade? {
var didUpgrade: DidUpgrade? {
get {
return storage["request-connection-upgrade"] as? Upgrade
return storage["request-upgrade"] as? DidUpgrade
}

set(upgrade) {
storage["request-connection-upgrade"] = upgrade
set(didUpgrade) {
storage["request-upgrade"] = didUpgrade
}
}

var userAgent: String? {
get {
return headers["User-Agent"].first
}

set(userAgent) {
headers["User-Agent"] = userAgent.map({Header($0)}) ?? []
}
Expand Down

0 comments on commit 9b2010e

Please sign in to comment.