From f5b2220a82e74a031175c6761feea8b7df9b88b3 Mon Sep 17 00:00:00 2001 From: Logan Wright Date: Thu, 16 Feb 2017 12:25:43 +0100 Subject: [PATCH] dependencies and makebytes --- Package.swift | 4 ++-- Sources/Routing/Branch.swift | 2 +- Tests/HTTPRoutingTests/AddTests.swift | 6 +++--- Tests/HTTPRoutingTests/GroupTests.swift | 8 ++++---- Tests/HTTPRoutingTests/GroupedTests.swift | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Package.swift b/Package.swift index ef2a09c8..d7e59a29 100644 --- a/Package.swift +++ b/Package.swift @@ -13,8 +13,8 @@ let package = Package( ], dependencies: [ // Core vapor transport layer - .Package(url: "https://github.com/vapor/engine.git", majorVersion: 1), - .Package(url: "https://github.com/vapor/node.git", majorVersion: 1) + .Package(url: "https://github.com/vapor/engine.git", Version(2,0,0, prereleaseIdentifiers: ["alpha"])), + .Package(url: "https://github.com/vapor/node.git", Version(2,0,0, prereleaseIdentifiers: ["alpha"])) ], exclude: [ "Sources/TypeSafeGenerator" diff --git a/Sources/Routing/Branch.swift b/Sources/Routing/Branch.swift index 24a1eabd..077853f8 100644 --- a/Sources/Routing/Branch.swift +++ b/Sources/Routing/Branch.swift @@ -15,7 +15,7 @@ extension Branch { public func slugs(for path: [String]) -> Node { var slugs: [String: Node] = [:] slugIndexes.forEach { key, index in - guard let val = path[safe: index].flatMap({ percentDecoded($0.bytes) }) else { return } + guard let val = path[safe: index].flatMap({ percentDecoded($0.makeBytes()) }) else { return } slugs[key] = Node.string(val.string) } return Node.object(slugs) diff --git a/Tests/HTTPRoutingTests/AddTests.swift b/Tests/HTTPRoutingTests/AddTests.swift index 986036d9..ddcc9b42 100644 --- a/Tests/HTTPRoutingTests/AddTests.swift +++ b/Tests/HTTPRoutingTests/AddTests.swift @@ -17,7 +17,7 @@ class AddTests: XCTestCase { let request = Request(method: .get, path: "ferret") let bytes = try request.bytes(running: router) - XCTAssertEqual(bytes, "foo".bytes) + XCTAssertEqual(bytes, "foo".makeBytes()) } func testVariadic() throws { @@ -29,7 +29,7 @@ class AddTests: XCTestCase { let request = Request(method: .trace, path: "foo/bar/baz") let bytes = try request.bytes(running: router) - XCTAssertEqual(bytes, "1337".bytes) + XCTAssertEqual(bytes, "1337".makeBytes()) } func testWithSlash() throws { @@ -41,6 +41,6 @@ class AddTests: XCTestCase { let request = Request(method: .get, path: "foo/bar") let bytes = try request.bytes(running: router) - XCTAssertEqual(bytes, "foo".bytes) + XCTAssertEqual(bytes, "foo".makeBytes()) } } diff --git a/Tests/HTTPRoutingTests/GroupTests.swift b/Tests/HTTPRoutingTests/GroupTests.swift index d86c0ea2..fbf7845b 100644 --- a/Tests/HTTPRoutingTests/GroupTests.swift +++ b/Tests/HTTPRoutingTests/GroupTests.swift @@ -22,7 +22,7 @@ class GroupTests: XCTestCase { let request = Request(method: .get, path: "users/5") let bytes = try request.bytes(running: router) - XCTAssertEqual(bytes, "show".bytes) + XCTAssertEqual(bytes, "show".makeBytes()) XCTAssertEqual(request.parameters["id"], "5") } @@ -37,7 +37,7 @@ class GroupTests: XCTestCase { let request = Request(method: .get, path: "users/devices/etc/5") let bytes = try request.bytes(running: router) - XCTAssertEqual(bytes, "show".bytes) + XCTAssertEqual(bytes, "show".makeBytes()) XCTAssertEqual(request.parameters["id"], "5") } @@ -56,7 +56,7 @@ class GroupTests: XCTestCase { let request = Request(method: .get, path: "host-only", host: "192.168.0.1") let bytes = try request.bytes(running: router) - XCTAssertEqual(bytes, "host".bytes) + XCTAssertEqual(bytes, "host".makeBytes()) } func testHostMiss() throws { @@ -74,6 +74,6 @@ class GroupTests: XCTestCase { let request = Request(method: .get, path: "host-only", host: "BADHOST") let bytes = try request.bytes(running: router) - XCTAssertEqual(bytes, "nothost".bytes) + XCTAssertEqual(bytes, "nothost".makeBytes()) } } diff --git a/Tests/HTTPRoutingTests/GroupedTests.swift b/Tests/HTTPRoutingTests/GroupedTests.swift index c10ff138..856d9227 100644 --- a/Tests/HTTPRoutingTests/GroupedTests.swift +++ b/Tests/HTTPRoutingTests/GroupedTests.swift @@ -21,7 +21,7 @@ class GroupedTests: XCTestCase { let request = Request(method: .get, path: "users/5") let bytes = try request.bytes(running: router) - XCTAssertEqual(bytes, "show".bytes) + XCTAssertEqual(bytes, "show".makeBytes()) XCTAssertEqual(request.parameters["id"], "5") } @@ -36,7 +36,7 @@ class GroupedTests: XCTestCase { let request = Request(method: .get, path: "users/devices/etc/5") let bytes = try request.bytes(running: router) - XCTAssertEqual(bytes, "show".bytes) + XCTAssertEqual(bytes, "show".makeBytes()) XCTAssertEqual(request.parameters["id"], "5") } @@ -51,7 +51,7 @@ class GroupedTests: XCTestCase { let request = Request(method: .get, path: "users/devices/etc/even/deeper/5") let bytes = try request.bytes(running: router) - XCTAssertEqual(bytes, "show".bytes) + XCTAssertEqual(bytes, "show".makeBytes()) XCTAssertEqual(request.parameters["id"], "5") } @@ -70,6 +70,6 @@ class GroupedTests: XCTestCase { let request = Request(method: .get, path: "host-only", host: "192.168.0.1") let bytes = try request.bytes(running: router) - XCTAssertEqual(bytes, "host".bytes) + XCTAssertEqual(bytes, "host".makeBytes()) } }