LibWeb: Simplify Fetch's build-content-range implementation

* Don't pass u64 by reference
* Don't double-format the range numbers
This commit is contained in:
Timothy Flynn 2025-11-25 11:02:12 -05:00 committed by Tim Flynn
parent d70224ad2e
commit 44fbf6451e
Notes: github-actions[bot] 2025-11-26 14:16:30 +00:00
2 changed files with 3 additions and 3 deletions

View file

@ -638,7 +638,7 @@ OrderedHashTable<ByteBuffer> convert_header_names_to_a_sorted_lowercase_set(Span
}
// https://fetch.spec.whatwg.org/#build-a-content-range
ByteString build_content_range(u64 const& range_start, u64 const& range_end, u64 const& full_length)
ByteString build_content_range(u64 range_start, u64 range_end, u64 full_length)
{
// 1. Let contentRange be `bytes `.
// 2. Append rangeStart, serialized and isomorphic encoded, to contentRange.
@ -647,7 +647,7 @@ ByteString build_content_range(u64 const& range_start, u64 const& range_end, u64
// 5. Append 0x2F (/) to contentRange.
// 6. Append fullLength, serialized and isomorphic encoded to contentRange.
// 7. Return contentRange.
return ByteString::formatted("bytes {}-{}/{}", String::number(range_start), String::number(range_end), String::number(full_length));
return ByteString::formatted("bytes {}-{}/{}", range_start, range_end, full_length);
}
// https://fetch.spec.whatwg.org/#simple-range-header-value