1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

AK: Remove the fallible constructor from FixedMemoryStream

This commit is contained in:
Tim Schumacher 2023-01-30 11:05:43 +01:00 committed by Linus Groh
parent 8b2f23d016
commit 220fbcaa7e
31 changed files with 185 additions and 209 deletions

View file

@ -336,8 +336,8 @@ ErrorOr<void> Client::handle_directory_listing(String const& requested_path, Str
builder.append("</html>\n"sv);
auto response = builder.to_deprecated_string();
auto stream = TRY(FixedMemoryStream::construct(response.bytes()));
return send_response(*stream, request, { .type = TRY(String::from_utf8("text/html"sv)), .length = response.length() });
FixedMemoryStream stream { response.bytes() };
return send_response(stream, request, { .type = TRY(String::from_utf8("text/html"sv)), .length = response.length() });
}
ErrorOr<void> Client::send_error_response(unsigned code, HTTP::HttpRequest const& request, Vector<String> const& headers)