carson-katri / swift-request

Declarative HTTP networking, designed for SwiftUI
MIT License
727 stars 41 forks source link

How to set the timeout #26

Closed ly410726 closed 4 years ago

ly410726 commented 4 years ago

How to set the timeout

carson-katri commented 4 years ago

There currently is no way to change the default URLSession timeout property.

It should be trivial to add something like:

Request {
    ...
    Timeout(30, for: .request)
    Timeout(60, for: .resource)
}

Then we can use the URLSessionConfiguration to change this internally. I'll work on this.

carson-katri commented 4 years ago

Please try out the dev branch. I've added timeout in #27