Description
Another big bump in a transition from URLSession
to HTTPClient
:
HTTPClient has no way of knowing the internet is offline or is disconnected. An executed request that hasn't connected will just result in a connection timeout, and a connected request that becomes disconnected during read/write will result in a read/write timeout, which with the shared singleton configuration is 90 seconds (!!!).
As a comparison, URLSession
's default configuration causes a request to fail immediately with NSURLErrorNotConnectedToInternet unless waitsForConnectivity is set to true
, in which case it then waits the full timeoutIntervalForRequest before failing, equivalent to AHC's Timeout.connect
. No matter what waitsForConnectivity
is set to, a disconnection from the internet during a connected request's read/write results in an immediate failure with NSURLErrorNetworkConnectionLost
I think URLSession
's default behavior is quite sensible, and it would be great to offer an equivalent in AHC.