diff --git a/kong/pdk/request.lua b/kong/pdk/request.lua index 06fb846a2ae..c3e31c2e3eb 100644 --- a/kong/pdk/request.lua +++ b/kong/pdk/request.lua @@ -45,6 +45,8 @@ local PHASES = phase_checker.phases cjson.decode_array_with_array_mt(true) +cjson.encode_sparse_array(nil, nil, 2^15) +cjson.encode_number_precision(16) local function new(self) diff --git a/kong/pdk/response.lua b/kong/pdk/response.lua index e196067cd31..3611421233d 100644 --- a/kong/pdk/response.lua +++ b/kong/pdk/response.lua @@ -13,13 +13,14 @@ local buffer = require "string.buffer" -local cjson = require "cjson.safe" +local cjson = require "cjson.safe".new() local checks = require "kong.pdk.private.checks" local phase_checker = require "kong.pdk.private.phases" local utils = require "kong.tools.utils" local request_id = require "kong.tracing.request_id" local constants = require "kong.constants" +cjson.encode_sparse_array(nil, nil, 2^15) cjson.encode_number_precision(16) local ngx = ngx diff --git a/kong/pdk/service/request.lua b/kong/pdk/service/request.lua index 495dbf0febc..5003e5a261b 100644 --- a/kong/pdk/service/request.lua +++ b/kong/pdk/service/request.lua @@ -2,7 +2,7 @@ -- Module for manipulating the request sent to the Service. -- @module kong.service.request -local cjson = require "cjson.safe" +local cjson = require "cjson.safe".new() local buffer = require "string.buffer" local checks = require "kong.pdk.private.checks" local phase_checker = require "kong.pdk.private.phases" @@ -24,6 +24,9 @@ local validate_headers = checks.validate_headers local check_phase = phase_checker.check local escape = require("kong.tools.uri").escape +cjson.encode_sparse_array(nil, nil, 2^15) +cjson.encode_number_precision(16) + local PHASES = phase_checker.phases diff --git a/kong/pdk/service/response.lua b/kong/pdk/service/response.lua index ec51fe4fac0..d57df3546eb 100644 --- a/kong/pdk/service/response.lua +++ b/kong/pdk/service/response.lua @@ -24,6 +24,8 @@ local check_phase = phase_checker.check cjson.decode_array_with_array_mt(true) +cjson.encode_sparse_array(nil, nil, 2^15) +cjson.encode_number_precision(16) local replace_dashes = string_tools.replace_dashes