From ef2ee8a546a20e3f08a959475c65f63e2e542215 Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 6 May 2018 21:52:47 -0400 Subject: [PATCH] added support for vapor 3.0.1 --- Package.swift | 2 +- Sources/Ferno/FernoRequest.swift | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Package.swift b/Package.swift index c889c4f..f10a699 100644 --- a/Package.swift +++ b/Package.swift @@ -14,7 +14,7 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - .package(url: "https://github.com/vapor/vapor.git", from: "3.0.0-rc.2.7"), + .package(url: "https://github.com/vapor/vapor.git", from: "3.0.1"), .package(url: "https://github.com/vapor/jwt.git", from: "3.0.0-rc.2.1.1") ], targets: [ diff --git a/Sources/Ferno/FernoRequest.swift b/Sources/Ferno/FernoRequest.swift index 36d9f3c..3ccf9db 100644 --- a/Sources/Ferno/FernoRequest.swift +++ b/Sources/Ferno/FernoRequest.swift @@ -39,7 +39,7 @@ public class FernoAPIRequest: FernoRequest { public func delete(req: Request, method: HTTPMethod, path: [String]) throws -> Future { return try self.createRequest(method: method, path: path, query: [], body: "", headers: [:]).flatMap({ request in - return try self.httpClient.respond(to: request).map({ response in + return self.httpClient.send(request).map({ response in return response.http.status == .ok }) }) @@ -47,7 +47,7 @@ public class FernoAPIRequest: FernoRequest { public func send(req: Request, method: HTTPMethod, path: [String], query: [FernoQuery], body: T, headers: HTTPHeaders) throws -> Future { return try self.createRequest(method: method, path: path, query: query, body: body, headers: headers).flatMap({ (request) in - return try self.httpClient.respond(to: request).flatMap(to: F.self) { response in + return self.httpClient.send(request).flatMap(to: F.self) { response in guard response.http.status == .ok else { throw FernoError.requestFailed } return try self.decoder.decode(F.self, from: response.http, maxSize: 65_536, on: req) } @@ -56,7 +56,7 @@ public class FernoAPIRequest: FernoRequest { public func sendMany(req: Request, method: HTTPMethod, path: [String], query: [FernoQuery], body: T, headers: HTTPHeaders) throws -> Future<[String: F]> { return try self.createRequest(method: method, path: path, query: query, body: body, headers: headers).flatMap({ (request) in - return try self.httpClient.respond(to: request).flatMap(to: [String: F].self) { response in + return self.httpClient.send(request).flatMap(to: [String: F].self) { response in guard response.http.status == .ok else { throw FernoError.requestFailed } return try self.decoder.decode(Snapshot.self, from: response.http, maxSize: 65_536, on: req).map { snapshot in return snapshot.data @@ -109,7 +109,7 @@ extension FernoAPIRequest { try req.content.encode(oauthBody, as: .urlEncodedForm) req.http.url = URL(string: "https://www.googleapis.com/oauth2/v4/token")! req.http.method = .POST - return try self.httpClient.respond(to: req).flatMap(to: OAuthResponse.self) { result in + return self.httpClient.send(req).flatMap(to: OAuthResponse.self) { result in let oauthRes: Future = try result.content.decode(OAuthResponse.self) return oauthRes }.map(to: String.self) { resp in