Open QuocBV opened 3 months ago
When I call get Object from API then I want to log Obj by kong.log.debug() here is my code
check it shows log "axios.get Success" but the next line is "axios.get err" I try to use another lib from npm example JSON5 but it always shows an error Can you help me how to serialize the object to string to trace log
When I call get Object from API then I want to log Obj by kong.log.debug() here is my code
async access(kong) { await kong.response.setHeader("Cache-access", new Date().toISOString()); await axios .get("https://microsoftedge.github.io/Demos/json-dummy-data/64KB.json") .then(function (response) { kong.log.debug("axios.get", " Success"); kong.log.debug("axios.get", JSON.stringify(response)); }) .catch(function (error) { kong.log.err("axios.get ", " err"); // handle error }) .finally(function () { // always executed kong.log.debug("axios.get ", " finally"); }); }
check it shows log "axios.get Success" but the next line is "axios.get err" I try to use another lib from npm example JSON5 but it always shows an error Can you help me how to serialize the object to string to trace log