cloudflare-docs
cloudflare-docs copied to clipboard
Content-length behavior in Workers isn't documented
Expected Behavior
The documentation should call out that the content-length header is ignored when constructing a custom response/request.
To have it set correctly, the body must be an instance of FixedLengthStream.
Actual Behavior
FixedLengthStream is undocumented. The fact that content-length is ignored for custom streams isn't mentioned.
Section that requires update
Request Response TransformStream or as a separate page under Streams
I assume forwarded requests/responses preserve the content-length. I assume a custom ReadableStream wrapping some custom underlying source doesn't work here & currently needs to be wrapped in FixedLengthStream. Probably a good idea to have examples on how to do this too.
OMG! I wasted so much time on this! Please update the doc 🙏