Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the TusPatchResponse to include the upload result. #55

Open
Haeavar opened this issue Oct 26, 2023 · 0 comments
Open

Improve the TusPatchResponse to include the upload result. #55

Haeavar opened this issue Oct 26, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Haeavar
Copy link

Haeavar commented Oct 26, 2023

Currently its quite difficult to handle a failed upload using TusPatchWithChunkAsync. If the upload fails while uploading a following chunk it returs the response of the previous (succeeded) chunk. If I now check the reponse for succeeded statuscode its not correct. I would need to check the size as well 8as you do it in the OnCompletedAsync callback.
Using the OnCompletedAsync callback to check for a suceeded call is a lot lines of code to write. If you could add a bool property 'UploadSuceeded' to the TusPatchResponse I could check easily for a succeeded call.
So, at the end of the TusPatchWithChunkAsync method just add following line:
tusPatchResponse.UploadSuceeded = (totalSize == uploadedSize);

Than, a caller could just do like that:
var result = await httpClient.TusPatchAsync(tusPatchRequestOption, cancellationToken); return result.UploadSuceeded;

@bluetianx bluetianx self-assigned this Oct 26, 2023
@bluetianx bluetianx added the enhancement New feature or request label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants