Skip to content

Commit

Permalink
thank you linux very cool
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuawright11 committed May 28, 2024
1 parent 4511c02 commit 2af3066
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Papyrus/Sources/Extensions/URLSession+Papyrus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ extension URLSession: HTTPService {
public func request(_ req: Request) async -> Response {
#if os(Linux) // Linux doesn't have access to async URLSession APIs
await withCheckedContinuation { continuation in
request(req, completionHandler: continuation.resume)
let urlRequest = req.urlRequest
dataTask(with: urlRequest) { data, response, error in
let response = _Response(request: urlRequest, response: response, error: error, body: data)
continuation.resume(returning: response)
}.resume()
}
#else
let urlRequest = req.urlRequest
Expand Down

0 comments on commit 2af3066

Please sign in to comment.