mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-08 01:51:57 +00:00
AK+Everywhere: Convert JSON value serialization to String
This removes the use of StringBuilder::OutputType (which was ByteString, and only used by the JSON classes). And it removes the StringBuilder template parameter from the serialization methods; this was only ever used with StringBuilder, so a template is pretty overkill here.
This commit is contained in:
parent
2c03de60da
commit
fe2dff4944
Notes:
github-actions[bot]
2025-02-21 00:28:53 +00:00
Author: https://github.com/trflynn89
Commit: fe2dff4944
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3631
Reviewed-by: https://github.com/awesomekling ✅
15 changed files with 98 additions and 95 deletions
|
@ -298,7 +298,7 @@ ErrorOr<void, Client::WrappedError> Client::send_success_response(HTTP::HttpRequ
|
|||
keep_alive = it->value.trim_whitespace().equals_ignoring_ascii_case("keep-alive"sv);
|
||||
|
||||
result = make_success_response(move(result));
|
||||
auto content = result.serialized<StringBuilder>();
|
||||
auto content = result.serialized();
|
||||
|
||||
StringBuilder builder;
|
||||
builder.append("HTTP/1.1 200 OK\r\n"sv);
|
||||
|
@ -309,7 +309,7 @@ ErrorOr<void, Client::WrappedError> Client::send_success_response(HTTP::HttpRequ
|
|||
builder.append("Connection: keep-alive\r\n"sv);
|
||||
builder.append("Cache-Control: no-cache\r\n"sv);
|
||||
builder.append("Content-Type: application/json; charset=utf-8\r\n"sv);
|
||||
builder.appendff("Content-Length: {}\r\n", content.length());
|
||||
builder.appendff("Content-Length: {}\r\n", content.byte_count());
|
||||
builder.append("\r\n"sv);
|
||||
builder.append(content);
|
||||
|
||||
|
@ -338,13 +338,13 @@ ErrorOr<void, Client::WrappedError> Client::send_error_response(HTTP::HttpReques
|
|||
JsonObject result;
|
||||
result.set("value"sv, move(error_response));
|
||||
|
||||
auto content = result.serialized<StringBuilder>();
|
||||
auto content = result.serialized();
|
||||
|
||||
StringBuilder builder;
|
||||
builder.appendff("HTTP/1.1 {} {}\r\n", error.http_status, reason);
|
||||
builder.append("Cache-Control: no-cache\r\n"sv);
|
||||
builder.append("Content-Type: application/json; charset=utf-8\r\n"sv);
|
||||
builder.appendff("Content-Length: {}\r\n", content.length());
|
||||
builder.appendff("Content-Length: {}\r\n", content.byte_count());
|
||||
builder.append("\r\n"sv);
|
||||
builder.append(content);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue