From 21af3d0920b20229323b8ab77c6e0c1b889482d2 Mon Sep 17 00:00:00 2001 From: Jungpyo Hong <54448459+jphong1111@users.noreply.github.com> Date: Wed, 19 May 2021 23:12:43 -0500 Subject: [PATCH] Update JSONParameterEncoder.swift --- Helper/Network Layer/Encoding/JSONParameterEncoder.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Helper/Network Layer/Encoding/JSONParameterEncoder.swift b/Helper/Network Layer/Encoding/JSONParameterEncoder.swift index 786e283..d8c7ab4 100644 --- a/Helper/Network Layer/Encoding/JSONParameterEncoder.swift +++ b/Helper/Network Layer/Encoding/JSONParameterEncoder.swift @@ -7,16 +7,16 @@ import Foundation -public struct JSONParameterEncoder: ParameterEncoder { - public func encode(urlRequest: inout URLRequest, with parameters: Parameters) throws { +struct JSONParameterEncoder: ParameterEncoder { + static func encode(urlRequest: inout URLRequest, with parameters: Parameters) throws { do { let jsonAsData = try JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted) urlRequest.httpBody = jsonAsData if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") } - }catch { - throw NetworkError.encodingFailed + } catch { + throw AppError.encodingFail } } }