diff --git a/Sources/Networking/Networking+New.swift b/Sources/Networking/Networking+New.swift index ffd5a54..9ae8530 100644 --- a/Sources/Networking/Networking+New.swift +++ b/Sources/Networking/Networking+New.swift @@ -42,12 +42,12 @@ extension Networking { switch statusCode.statusCodeType { case .informational, .successful: logger.info("Received successful response with status code \(statusCode) from \(path, privacy: .public)") - if T.self == NetworkingJSON.self { + if T.self == NetworkingResponse.self { let headers = Dictionary(uniqueKeysWithValues: httpResponse.allHeaderFields.compactMap { key, value in (key as? String).map { ($0, AnyCodable(value)) } }) let body = try JSONDecoder().decode([String: AnyCodable].self, from: responseData) - let networkingJSON = NetworkingJSON(headers: headers, body: body) + let networkingJSON = NetworkingResponse(headers: headers, body: body) return .success(networkingJSON as! T) } else { let decoder = JSONDecoder() diff --git a/Sources/Networking/NetworkingJSON.swift b/Sources/Networking/NetworkingResponse.swift similarity index 98% rename from Sources/Networking/NetworkingJSON.swift rename to Sources/Networking/NetworkingResponse.swift index f969c18..a9add1e 100644 --- a/Sources/Networking/NetworkingJSON.swift +++ b/Sources/Networking/NetworkingResponse.swift @@ -1,6 +1,6 @@ import Foundation -public struct NetworkingJSON: Decodable { +public struct NetworkingResponse: Decodable { public let headers: [String: AnyCodable] public let body: [String: AnyCodable] } diff --git a/Tests/NetworkingTests/GETTests.swift b/Tests/NetworkingTests/GETTests.swift index 773de0f..8099210 100644 --- a/Tests/NetworkingTests/GETTests.swift +++ b/Tests/NetworkingTests/GETTests.swift @@ -259,7 +259,7 @@ class GETTests: XCTestCase { func testNetworkingJSON() async throws { let networking = Networking(baseURL: baseURL) - let result: Result = await networking.newGet("/auth") + let result: Result = await networking.newGet("/auth") switch result { case .success(let success): let header = success.headers.string(for: "access-token")