mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:07:45 +00:00
Everywhere: Add deprecated_ prefix to JsonValue::to_byte_string
`JsonValue::to_byte_string` has peculiar type-erasure semantics which is not usually intended. Unfortunately, it also has a very stereotypical name which does not warn about unexpected behavior. So let's prefix it with `deprecated_` to make new code use `as_string` if it just wants to get string value or `serialized<StringBuilder>` if it needs to do proper serialization.
This commit is contained in:
parent
4ed5287792
commit
ccd701809f
20 changed files with 46 additions and 50 deletions
|
@ -144,7 +144,7 @@ void DynamicWidgetContainer::restore_view_state()
|
|||
|
||||
order_or_error.value().as_array().for_each([&](auto& section_label) {
|
||||
for (auto& container : containers) {
|
||||
if (container.section_label() == section_label.to_byte_string())
|
||||
if (container.section_label() == section_label.as_string())
|
||||
new_child_order.append(container);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -138,7 +138,7 @@ Variant JsonArrayModel::data(ModelIndex const& index, ModelRole role) const
|
|||
return "";
|
||||
if (data->is_number())
|
||||
return data.value();
|
||||
return data->to_byte_string();
|
||||
return data->as_string();
|
||||
}
|
||||
|
||||
if (role == ModelRole::Sort) {
|
||||
|
|
|
@ -439,7 +439,7 @@ Value JSONObject::parse_json_value(VM& vm, JsonValue const& value)
|
|||
if (value.is_number())
|
||||
return Value(value.to_double(0));
|
||||
if (value.is_string())
|
||||
return PrimitiveString::create(vm, value.to_byte_string());
|
||||
return PrimitiveString::create(vm, value.as_string());
|
||||
if (value.is_bool())
|
||||
return Value(static_cast<bool>(value.as_bool()));
|
||||
VERIFY_NOT_REACHED();
|
||||
|
|
|
@ -269,8 +269,7 @@ ErrorOr<void, Client::WrappedError> Client::handle_request(JsonValue body)
|
|||
{
|
||||
if constexpr (WEBDRIVER_DEBUG) {
|
||||
dbgln("Got HTTP request: {} {}", m_request->method_name(), m_request->resource());
|
||||
if (!body.is_null())
|
||||
dbgln("Body: {}", body.to_byte_string());
|
||||
dbgln("Body: {}", body);
|
||||
}
|
||||
|
||||
auto [handler, parameters] = TRY(match_route(*m_request));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue