From f7b45ea7fc4e9e7931d13c5112895c2b614f1a1c Mon Sep 17 00:00:00 2001 From: tanner0101 Date: Tue, 27 Aug 2019 16:34:39 -0400 Subject: [PATCH] cascade ws client error to promise --- Tests/VaporTests/ApplicationTests.swift | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Tests/VaporTests/ApplicationTests.swift b/Tests/VaporTests/ApplicationTests.swift index bf6942bcd8..204d782b13 100644 --- a/Tests/VaporTests/ApplicationTests.swift +++ b/Tests/VaporTests/ApplicationTests.swift @@ -394,7 +394,7 @@ final class ApplicationTests: XCTestCase { let app = Application.create(routes: { r, c in r.get("ws") { req -> EventLoopFuture in let promise = req.eventLoop.makePromise(of: String.self) - return WebSocket.connect( + WebSocket.connect( to: "ws://echo.websocket.org/", on: req.eventLoop ) { ws in @@ -403,9 +403,8 @@ final class ApplicationTests: XCTestCase { promise.succeed(text) ws.close().cascadeFailure(to: promise) } - }.flatMap { - return promise.futureResult - } + }.cascadeFailure(to: promise) + return promise.futureResult } }) defer { app.shutdown() }