diff --git a/Sources/AppVaporTestTools/routes.swift b/Sources/AppVaporTestTools/routes.swift index 886b355..858bd34 100644 --- a/Sources/AppVaporTestTools/routes.swift +++ b/Sources/AppVaporTestTools/routes.swift @@ -13,7 +13,7 @@ public func routes(_ router: Router) throws { router.get("ping") { (req)->Future in let ping = "{ \"code\": \"pong\" }" - return try JSONDecoder().decode(MyObject.self, from: HTTPBody(string: ping)) + return try JSONDecoder().decode(MyObject.self, from: HTTPBody(string: ping), maxSize: 500, on: req) } // Example of creating a Service and using it. diff --git a/Sources/VaporTestTools/Extensions/Response tools/Response+Debug.swift b/Sources/VaporTestTools/Extensions/Response tools/Response+Debug.swift index 1ddd923..3bd7a0e 100644 --- a/Sources/VaporTestTools/Extensions/Response tools/Response+Debug.swift +++ b/Sources/VaporTestTools/Extensions/Response tools/Response+Debug.swift @@ -19,7 +19,7 @@ extension TestableProperty where TestableType: Response { print("\t\(header.name.description) = \(header.value)") } print("Content:") - if let size = element.content.body?.count { + if let size = element.content.body.count { print("\tSize: \(String(size))") } if let mediaType = element.content.mediaType { diff --git a/Sources/VaporTestTools/Extensions/Response tools/Response+Getters.swift b/Sources/VaporTestTools/Extensions/Response tools/Response+Getters.swift index e9497ff..fbfac8b 100644 --- a/Sources/VaporTestTools/Extensions/Response tools/Response+Getters.swift +++ b/Sources/VaporTestTools/Extensions/Response tools/Response+Getters.swift @@ -27,22 +27,22 @@ extension TestableProperty where TestableType: Response { } public var contentSize: Int? { - return element.content.body?.count + return element.content.body.count } public var contentString: String? { - guard let data = try? element.content.body?.consumeData(max: 500000, on: fakeRequest()).wait() else { + guard let data = try? element.content.body.consumeData(max: 500000, on: fakeRequest()).wait() else { return nil } - return String(data: data!, encoding: .utf8) + return String(data: data, encoding: .utf8) } public func contentString(encoding: String.Encoding) -> String? { - guard let data = try? element.content.body?.consumeData(max: 500000, on: fakeRequest()).wait() else { + guard let data = try? element.content.body.consumeData(max: 500000, on: fakeRequest()).wait() else { return nil } - return String(data: data!, encoding: encoding) + return String(data: data, encoding: encoding) } } diff --git a/scripts/update.sh b/scripts/update.sh new file mode 100755 index 0000000..bd70fb8 --- /dev/null +++ b/scripts/update.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +rm -rf .build +vapor clean --verbose -y +rm Package.resolved +vapor xcode --verbose -y