immobiliare / RealHTTP

🌀swift async http client - fast, lightweight, type-safe
MIT License
282 stars 28 forks source link

HTTPClient and URLSessionTask are removed after the completion, also breaking the cURLDescription() #56

Closed malcommac closed 2 years ago

malcommac commented 2 years ago

Bug Report

Once the network operation is finished both client and sessionTask of the origin request are set to nil so calling the curlDescription() function results in an error.

This happens in completeTask(_ task: URLSessionTask, error: Error?) function:

        // Reset the link to the client
        handler.request.client = nil
        handler.request.sessionTask = nil

There is no need anymore to reset these values, client is already a weak var.