cloudflare-docs icon indicating copy to clipboard operation
cloudflare-docs copied to clipboard

Content-length behavior in Workers isn't documented

Open vlovich opened this issue 3 years ago • 1 comments

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

vlovich avatar Feb 11 '22 18:02 vlovich

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.

vlovich avatar Feb 11 '22 18:02 vlovich

OMG! I wasted so much time on this! Please update the doc 🙏

gregory avatar Nov 09 '22 08:11 gregory