Skip to content
This repository has been archived by the owner on Jan 25, 2019. It is now read-only.

NetworkClient request to return the URLSessionTask #177

Open
markst opened this issue Apr 6, 2017 · 1 comment
Open

NetworkClient request to return the URLSessionTask #177

markst opened this issue Apr 6, 2017 · 1 comment

Comments

@markst
Copy link

markst commented Apr 6, 2017

Related to issue #96. I'd like to be able to cancel the network request.
If the NetworkClient protocol function were to return the URLSessionTask performed:

func request(method: String, url: URL, payload: Data?, callback: @escaping NetworkClientCallback) -> URLSessionTask

It would be possible to cancel the request upon cancelling the operation:

override public func cancel() {
    super.cancel()
    self.networkTask?.cancel()
}
@markst
Copy link
Author

markst commented Apr 6, 2017

Happy to create a PR if you think this is a good idea.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant