tus / tus-resumable-upload-protocol

Open Protocol for Resumable File Uploads
https://tus.io
MIT License
1.49k stars 102 forks source link

PATCH when file does not exists? #130

Closed ronag closed 5 years ago

ronag commented 6 years ago

Should PATCH be allowed before POST with id? e.g.

PATCH /asd
POST /asd
Acconut commented 6 years ago

No, this is not allowed and also should not be, at least in my opinion. The server will not have allocated the necessary resources to accept an upload and therefore will not be able to fulfill your request. Or am I misunderstanding you here?

ronag commented 6 years ago

@Acconut: I'm cool with that. Though maybe we should add it to the spec? Because the HTTP spec does not enforce that invariant.

Acconut commented 6 years ago

Yes, we can add this to the spec. However, I am unsure about how to formulate that because following thing just came to my mind: If you are not using the Creation extension (which is totally optional), there will never be a POST request from the client. In this case you will have proprietary server extension which handles the upload creation in another way (maybe through another API). Then the client will send the usual PATCH requests to the upload URL without ever having sent a POST request.

This setup is not very common but does occur, e.g. in the Vimeo API.