tus / tus-java-client

The tus client for Java.
https://tus.io
MIT License
213 stars 88 forks source link

TusUpload should have mandatory fields. #34

Closed klawyMarcin closed 1 year ago

klawyMarcin commented 4 years ago

Field "size" in TusUpload should be mandatory when using streams. I didn't provide it and upload worked BUT on receiver side there was a problem with object UploadInfo (method uploadInfo.isUploadInProgress() in particular). Despite upload being finished isUploadInProgress showed "true". Moreover on client side field is named size, and on server side it's called length. It's a bit misleading.

As a solution I propose to remove no arguments constructor and replace it with constructor, that accepts all required parameters. Or to use builder that throws exceptions if not all mandatory field combinations are provided.

Acconut commented 4 years ago

Thank you for the feedback and the recommendations! Frankly, I have never thought about that.

As a solution I propose to remove no arguments constructor and replace it with constructor, that accepts all required parameters.

That's a good idea! Would you be willing to open a PR for this?

Acconut commented 1 year ago

We will address this in the next major release: https://github.com/tus/tus-java-client/issues/78