kean / Get

Web API client built using async/await
MIT License
943 stars 75 forks source link

Add urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:) to DataLoader's implemented delegate callbacks #77

Closed jnouwen closed 1 year ago

jnouwen commented 1 year ago

Would it be possible to add urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:) to DataLoader's list of implemented URLSessionTaskDelegate callbacks?

I'm not using one of APIClient's upload(...) functions where I could just set the delegate directly because those functions don't do multipart form requests (unless I'm missing something?) and thus can't get at the uploaded file on my PHP server side, so I instead implemented them "manually" with send(..) by modifying the inout URLRequest directly. Unfortunately, since DataLoader doesn't have the requested callback implemented, I can't monitor the progress of the data send.

I was just going to add it in an extension, but DataLoader isn't exposed outside the package.

kean commented 1 year ago

Absolutely. It looks like something I missed. PRs are welcome.