Cover whitespace-padded suffix and open-ended ranges

Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
Cursor AgentandTheo Browne committed 2026-02-10 05:07:15 +00:00
1 parent c1bec99a7a
commit cd327137fd
1 file changed
+14
+14
View File
@@ -1040,6 +1040,13 @@ describe("parseByteRangeHeader", () => {
});
});
it("parses whitespace-padded open-ended ranges", () => {
expect(parseByteRangeHeader("bytes = 10 - ", 100)).toEqual({
start: 10,
end: 99,
});
});
it("parses suffix ranges", () => {
expect(parseByteRangeHeader("bytes=-5", 100)).toEqual({
start: 95,
@@ -1047,6 +1054,13 @@ describe("parseByteRangeHeader", () => {
});
});
it("parses whitespace-padded suffix ranges", () => {
expect(parseByteRangeHeader("bytes = - 5", 100)).toEqual({
start: 95,
end: 99,
});
});
it("clamps oversized suffix ranges to full file", () => {
expect(parseByteRangeHeader("bytes=-500", 100)).toEqual({
start: 0,