Skip to content

Commit

Permalink
Merge pull request #7 from loloop/mc/fix-async-linux
Browse files Browse the repository at this point in the history
fixes issues where new APIClient wasn't calling our URLSession extension
  • Loading branch information
loloop authored Nov 9, 2023
2 parents 3f36700 + 6c6c48d commit 594865c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions telegram/Sources/LandinhoBot/APIClient/APIClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ struct APIClient<T: Decodable> {
decoder.dateDecodingStrategy = .iso8601

do {
let response = try decoder.decode(T.self, from: data.0)
let response = try decoder.decode(T.self, from: data)
return response
} catch (let error) {
let result = String(data: data.0, encoding: .utf8) ?? "Couldn't decode JSON"
let result = String(data: data, encoding: .utf8) ?? "Couldn't decode JSON"
throw APIClientError(message: """
\(error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import FoundationNetworking
#endif

extension URLSession {
func data(url: URL) async throws -> Data {
func data(from url: URL) async throws -> Data {
try await withCheckedThrowingContinuation { continuation in
let request = URLRequest(url: url)
let task = dataTask(with: request) { data, _, error in
Expand Down

0 comments on commit 594865c

Please sign in to comment.