Comments (3)
Content-Type, unfortunately, MUST be set to application/offset+octet-stream as per the protocol definition
For good reason, in my mind. If I send a PATCH request with the second half of a PNG image, the content type of that request is not image/png
since it's not a valid PNG image. The only case where the content type could be image/png
would be if the client intends to upload the entire file in a single PATCH request. In the other cases, we would have to use a different content type. And since I don't think it's a good idea to have rules with such exceptions, we settled on using upload metadata for transferring the file type. Is that relatable?
Alternatively, I think that TUS should at least define the Upload-Metadata key content-type to specify the actual content-type.
Good idea. tusd and Uppy.js already use the filename
and filetype
metadata values for filling in the Content-Type header for GET responses. It would be good to add them as a recommendation to the specification.
from tus-resumable-upload-protocol.
re @Acconut
HTTP does not use that strict a definition: https://httpwg.org/specs/rfc7231.html#header.content-type
The "Content-Type" header field indicates the media type of the associated representation: either the representation enclosed in the message payload or the selected representation
and then in https://httpwg.org/specs/rfc7231.html#representations
For the purposes of HTTP, a "representation" is information that is intended to reflect a past, current, or desired state of a given resource
TUS PATCH
requests can be seen analogous to 206 responses to Range requests where the Content-Type
still refers to the entirety of the requested object and not just the particular response body.
So while I understand how this came about, I still think that changing the use of Content-Type
would be more in line with HTTP.
That said, even if you decided to not change it for a future protocol version, I agree that some metadata values should be reserved for these semantics.
from tus-resumable-upload-protocol.
HTTP does not use that strict a definition
That's interesting, good to know. Thanks for bringing it up!
even if you decided to not change it for a future protocol version
Yes, I would like to do that. tus clients already have to specify custom headers, so adding the upload metadata header is not a problem in my mind.
I agree that some metadata values should be reserved for these semantics.
Absolutely, we should definitely do that!
from tus-resumable-upload-protocol.
Related Issues (20)
- Future definition of the Tus-Resumable header HOT 10
- Spam: Nutt
- Spam: Nutt
- Request: Swagger / OpenAPI documentation of the API HOT 8
- Byte-range support for iOS compatibility HOT 2
- > net::ERR_UPLOAD_FILE_CHANGED HOT 2
- Body is not specified in OpenAPI HOT 1
- MIME-type Extension HOT 4
- Unable to resume uploads, Upload-Offset is always 0 HOT 1
- support http/3 HOT 1
- OWASP Considerations HOT 4
- > net::ERR_UPLOAD_FILE_CHANGED HOT 1
- Protocol version confusion HOT 2
- Upload Post-Processing HOT 13
- Ambiguous Tus-Concatenation specifications HOT 4
- Which StatusCode of response must server return, if server want to indicate a success HEAD request HOT 5
- How Can I learn about Tus V2? HOT 3
- Add extension to allow for discovery of existing upload URL HOT 4
- Upload-Metadata could be Structured Field Values (RFC 8941) HOT 3
- Support zero length uploads HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tus-resumable-upload-protocol.