mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-30 06:52:52 +00:00
AK: Make String::number() infallible
This API will always succeed in creating a String representing the provided number in base-10.
This commit is contained in:
parent
03569fc509
commit
dd419b5a8d
Notes:
github-actions[bot]
2024-10-14 18:49:07 +00:00
Author: https://github.com/awesomekling
Commit: dd419b5a8d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1796
46 changed files with 77 additions and 81 deletions
|
@ -272,14 +272,14 @@ void Request::add_range_header(u64 first, Optional<u64> const& last)
|
|||
auto range_value = MUST(ByteBuffer::copy("bytes"sv.bytes()));
|
||||
|
||||
// 3. Serialize and isomorphic encode first, and append the result to rangeValue.
|
||||
range_value.append(MUST(String::number(first)).bytes());
|
||||
range_value.append(String::number(first).bytes());
|
||||
|
||||
// 4. Append 0x2D (-) to rangeValue.
|
||||
range_value.append('-');
|
||||
|
||||
// 5. If last is given, then serialize and isomorphic encode it, and append the result to rangeValue.
|
||||
if (last.has_value())
|
||||
range_value.append(MUST(String::number(*last)).bytes());
|
||||
range_value.append(String::number(*last).bytes());
|
||||
|
||||
// 6. Append (`Range`, rangeValue) to request’s header list.
|
||||
auto header = Header {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue