Partial File Download Drops the Final Byte
Level 2 · node · API · HTTP Range boundary handling error
Scenario
A document service supports a single byte range so mobile clients can resume downloads. Full downloads work normally, but operations reports that byte-range responses omit the final byte shown in Content-Range, corrupting data when downloaded chunks are joined. The controller passes a parsed Range through the download service to the file repository.
Requirements
- Without Range, return the entire file with status 200 - Treat end in bytes=start-end as an inclusive byte position - A partial response body has length end-start+1 - A partial response returns status 206 and an accurate Content-Range - A valid range ending at the file boundary includes the final byte
Acceptance criteria
- A request without Range returns the entire file
- A single-byte range returns exactly one byte
- A multi-byte range includes the byte at the end position
- Content-Range and body length agree for a partial response
- A range whose end is the final file position includes the final byte