From 3a6373f86345bafaf535283983a47cadea05aad3 Mon Sep 17 00:00:00 2001 From: Demis Bellot Date: Fri, 19 Mar 2021 22:30:53 +0800 Subject: [PATCH] Unescape slahes in Inspect.dump --- Sources/ServiceStack/Inspect.swift | 4 +++- Tests/ServiceStackTests/AutoQueryTests.swift | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/ServiceStack/Inspect.swift b/Sources/ServiceStack/Inspect.swift index 7da5193..2c1ef53 100644 --- a/Sources/ServiceStack/Inspect.swift +++ b/Sources/ServiceStack/Inspect.swift @@ -60,7 +60,9 @@ public class Inspect { encoder.outputFormatting = .prettyPrinted if let data = try? encoder.encode(obj) { let json = String(data: data, encoding: .utf8)! - return json.replacingOccurrences(of:"\"", with: "") + return json + .replacingOccurrences(of:"\"", with: "") + .replacingOccurrences(of:"\\/", with: "/") } else { var toStr = String() Swift.dump(obj, to:&toStr) diff --git a/Tests/ServiceStackTests/AutoQueryTests.swift b/Tests/ServiceStackTests/AutoQueryTests.swift index 7185815..d22ce9e 100644 --- a/Tests/ServiceStackTests/AutoQueryTests.swift +++ b/Tests/ServiceStackTests/AutoQueryTests.swift @@ -38,7 +38,8 @@ class AutoQueryTests: XCTestCase { do { let response = try client.get(request) - + +// Inspect.printDump(response) XCTAssertEqual(response.total, 15) XCTAssertEqual(response.results.count, 3) let names = response.results.map { $0.name! }.joined(separator: ",")