diff --git a/Sources/Networking/Networking+HTTPRequests.swift b/Sources/Networking/Networking+HTTPRequests.swift index 3c251fe..ef05626 100644 --- a/Sources/Networking/Networking+HTTPRequests.swift +++ b/Sources/Networking/Networking+HTTPRequests.swift @@ -63,6 +63,16 @@ public extension Networking { return await handle(.put, path: path, parameters: parameters) } + func newPut(_ path: String, parameters: [String: Any]) async -> Result { + let result: Result = await handle(.put, path: path, parameters: parameters) + switch result { + case .success: + return .success(()) + case .failure(let error): + return .failure(error) + } + } + func newDelete(_ path: String) async -> Result { let result: Result = await handle(.delete, path: path, parameters: nil) switch result { diff --git a/Sources/Networking/Networking+New.swift b/Sources/Networking/Networking+New.swift index 56f5189..182d917 100644 --- a/Sources/Networking/Networking+New.swift +++ b/Sources/Networking/Networking+New.swift @@ -15,7 +15,7 @@ extension Networking { let result = try JSONResult(body: fakeRequest.response, response: response, error: error) switch result { case .success(let response): - if T.self == Void.self { + if T.self == Data.self { logger.info("Successfully processed fake request to \(path, privacy: .public)") return .success(() as! T) } else { @@ -47,8 +47,8 @@ extension Networking { switch statusCode.statusCodeType { case .informational, .successful: logger.info("Received successful response with status code \(statusCode) from \(path, privacy: .public)") - if T.self == Void.self { - return .success(() as! T) + if T.self == Data.self { + return .success(Data() as! T) } else if T.self == NetworkingResponse.self { let headers = Dictionary(uniqueKeysWithValues: httpResponse.allHeaderFields.compactMap { key, value in (key as? String).map { ($0, AnyCodable(value)) }