diff --git a/sky_phone/source/client/custom_apps.lua b/sky_phone/source/client/custom_apps.lua index 87b4222..ea0ed2c 100644 --- a/sky_phone/source/client/custom_apps.lua +++ b/sky_phone/source/client/custom_apps.lua @@ -280,7 +280,8 @@ local function normalize_json_payload(payload, maximum_bytes) return nil, "payload_too_large" end - return json.decode(encoded) + local decoded = json.decode(encoded) + return decoded end local function validate_optional_text(value, error_code, maximum_length) diff --git a/tests/custom_app_compat_client.lua b/tests/custom_app_compat_client.lua index 558184d..09353b2 100644 --- a/tests/custom_app_compat_client.lua +++ b/tests/custom_app_compat_client.lua @@ -24,10 +24,16 @@ Config = { } json = { - decode = function() + decode = function(encoded) + if encoded == "null" then + return nil, 5 + end return {} end, - encode = function() + encode = function(value) + if value == nil then + return "null" + end return "{}" end, }