Open kennylevinsen opened 1 year ago
The problem is that CupertinoClient
needs to control the URLSession
delegate.
Why do you want to reuse the URLSession
?
I am making many requests to a single service and would like to use the same connection pool and configuration. For many things I just use the general http interface, but I also need to use downloadTask which is not exposed outside URLSession.
The available options seem to be:
The problem is that CupertinoClient needs to control the URLSession delegate.
Ah, hmm. I suppose the newer async methods taking a URLSessionTaskDelegate would work better here. "Rewrite everything in Swift to use new async APIs" is a larger request than I intended to make though, so I will probably hack around it locally for now.
(3) seems like a good option.
I wonder what a good API would look like? Using callbacks doesn't seem very Dart-y.
I have a use-case where I want to:
I would like to use the same URLSession for both of these. One way would be to allow a CupertinoClient to be constructed from a URLSession, another to make the internal URLSession public.