mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-22 23:58:36 +01:00
Use the same API for removing feeds Feedly web does and side step potential encoding issues. Attempt to fix #1691.
This commit is contained in:
parent
4b1c40f264
commit
8d11ee6c82
@ -281,14 +281,8 @@ final class FeedlyAPICaller {
|
||||
}
|
||||
}
|
||||
|
||||
guard let encodedFeedId = encodeForURLPath(feedId) else {
|
||||
return DispatchQueue.main.async {
|
||||
completion(.failure(FeedlyAccountDelegateError.unexpectedResourceId(feedId)))
|
||||
}
|
||||
}
|
||||
|
||||
var components = baseUrlComponents
|
||||
components.percentEncodedPath = "/v3/collections/\(encodedCollectionId)/feeds/\(encodedFeedId)"
|
||||
components.percentEncodedPath = "/v3/collections/\(encodedCollectionId)/feeds/.mdelete"
|
||||
|
||||
guard let url = components.url else {
|
||||
fatalError("\(components) does not produce a valid URL.")
|
||||
@ -300,6 +294,19 @@ final class FeedlyAPICaller {
|
||||
request.addValue("application/json", forHTTPHeaderField: "Accept-Type")
|
||||
request.addValue("OAuth \(accessToken)", forHTTPHeaderField: HTTPRequestHeader.authorization)
|
||||
|
||||
do {
|
||||
struct RemovableFeed: Encodable {
|
||||
let id: String
|
||||
}
|
||||
let encoder = JSONEncoder()
|
||||
let data = try encoder.encode([RemovableFeed(id: feedId)])
|
||||
request.httpBody = data
|
||||
} catch {
|
||||
return DispatchQueue.main.async {
|
||||
completion(.failure(error))
|
||||
}
|
||||
}
|
||||
|
||||
transport.send(request: request, resultType: [FeedlyFeed].self, dateDecoding: .millisecondsSince1970, keyDecoding: .convertFromSnakeCase) { result in
|
||||
switch result {
|
||||
case .success((let httpResponse, _)):
|
||||
|
Loading…
Reference in New Issue
Block a user