Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
fix: ignore unknown fields when decoding lnd rest responses (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel committed Jul 6, 2020
1 parent 0c914b9 commit b1732f1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion SwiftLnd/Api/Tor/LndRest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ final class LNDRest: NSObject, URLSessionDelegate {
completion(.failure(.restNetworkError))
} else {
if let data = data, !data.isEmpty {
if let result = try? T(jsonUTF8Data: data) {
var decodingOptions = JSONDecodingOptions()
decodingOptions.ignoreUnknownFields = true
if let result = try? T(jsonUTF8Data: data, options: decodingOptions) {
completion(.success(result))
} else if let error = try? JSONDecoder().decode(RestError.self, from: data) {
completion(.failure(LndApiError(statusMessage: error.error)))
Expand Down

0 comments on commit b1732f1

Please sign in to comment.