Comments (5)
Hi, I'm surprised tusd allows it because a 204
PATCH is not allowed to have a body (cc @Acconut). And you are not allowed to change the status code:
The Server MUST acknowledge successful PATCH requests with the 204 No Content
— https://tus.io/protocols/resumable-upload#patch
Regarding headers, have you tried res.setHeader()
in your hook?
If we want to change the return type it would have to be backwards compatible as done here: #599. But let's first discuss whether it makes sense at all.
from tus-node-server.
Hi, I'm surprised tusd allows it because a
204
PATCH is not allowed to have a body (cc @Acconut). And you are not allowed to change the status code:The Server MUST acknowledge successful PATCH requests with the 204 No Content
— https://tus.io/protocols/resumable-upload#patch
In hindsight, enforcing a 204 is a bit too restrictive and we should also allow 200 as most clients will accept both, in my experience. If people want to have custom response bodies for PATCH requests and their client implementations support that, I don't see a reason why tusd should interfere here.
from tus-node-server.
Makes sense! But since we're following the current version of the spec now, what are you thoughts on sending a body with 204
, which generally isn't allowed? Or do you think it's better to deviate from the spec in this case and allow 200
with a body?
from tus-node-server.
I think our servers should only generate 204 responses on their own assuming no manual intervention via hooks or events was performed (as tusd and tus-node-server currently do). If users decide to deviate from the spec and change the response code or body they can do so, but at their own risk. But I would not include logic in tus-node-server to automatically use a 200 if the user specified a body. The response code should explicitly be set by the user in such cases.
from tus-node-server.
Regarding 204, MDN web docs states that The protocol allows user agents to vary in how they process such responses. This is observable in persistent connections, where the invalid body may include a distinct response to a subsequent request. Apple Safari rejects any such data. Google Chrome and Microsoft Edge discard up to four invalid bytes preceding a valid response. Firefox tolerates in excess of a kilobyte of invalid data preceding a valid response.
In this case there must be support for using 200. I think its fine that the status code must be changed manually.
from tus-node-server.
Related Issues (20)
- CRC errors using @google-cloud/storage 7.7.0 HOT 2
- Mixed content error - Page load over https buyt requested url is insecure HOT 1
- @tus/s3-store: Doesn't work with R2 HOT 1
- S3-store doen't work with Cloudflare R2 storage HOT 2
- Respect X-Forwarded-Port and X-Forwarded-Prefix as well HOT 2
- serverless integration HOT 1
- Upload fail after 10min request HOT 3
- Error installing 1.4.0 from npm HOT 2
- tus-node-server and ietf HOT 11
- Simultaneous file upload leads to corrupted files HOT 2
- Is there a way to pass variables between the `onUploadCreate` and the `onUploadFinish` functions? HOT 12
- Allow hooks to override metadata HOT 1
- Recommended nginx configuration HOT 2
- How to get final name back in client? HOT 4
- [S3Store] 0 bytes files are not uploaded HOT 1
- "Store files in custom nested directories" example fails with can't patch error HOT 10
- @tus/[email protected] breaking upload. 404 error HOT 8
- Upload using tus but serve files directly from s3 or using nginx without tus server HOT 5
- S3store creating extra .info file HOT 1
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-node-server.