diff --git a/Sources/Networking/NetworkRequestPerformer+JSON.swift b/Sources/Networking/NetworkRequestPerformer+JSON.swift index c3fcd3b..912e97e 100644 --- a/Sources/Networking/NetworkRequestPerformer+JSON.swift +++ b/Sources/Networking/NetworkRequestPerformer+JSON.swift @@ -15,14 +15,13 @@ extension NetworkRequestPerformer { /// - Parameters: /// - request: The request to perform. /// - requestBehaviors: The behaviors to apply to the given request. + /// - decoder: The JSON decoder to use when decoding the data. /// - completion: A completion closure that is called when the request has been completed. /// - Returns: The `URLSessionDataTask` used to send the request. The implementation must call `resume()` on the task before returning. - @discardableResult public func send(_ request: NetworkRequest, requestBehaviors: [RequestBehavior] = [], completion: ((Result) -> Void)? = nil) -> URLSessionDataTask { + @discardableResult public func send(_ request: NetworkRequest, requestBehaviors: [RequestBehavior] = [], decoder: JSONDecoder = JSONDecoder(), completion: ((Result) -> Void)? = nil) -> URLSessionDataTask { send(request, requestBehaviors: requestBehaviors) { result in switch result { case let .success(response): - - let decoder = JSONDecoder() if let data = response.data { do { let decodedInstance = try decoder.decode(ResponseType.self, from: data)