From 145e22de2182b3cb2732763c39557b3125486f93 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Thu, 4 Jul 2024 10:56:48 +0900 Subject: [PATCH] Update http.js --- lib/http.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/http.js b/lib/http.js index cd543f4..3aa9758 100644 --- a/lib/http.js +++ b/lib/http.js @@ -604,11 +604,12 @@ var HTTPObject = function(engine) { } if (this.isJSONResponse()) { - if (typeof(WScript) !== "undefined") { - JSON = {}; - FILE.includeFile("app/assets/js/json2.js"); + try { + this.setResponseBody(JSON.parse(responseText)); + } catch (e) { + console.error("JSON parse error: " + e.message); + this.setResponseBody({}); } - this.setResponseBody(JSON.parse(responseText)); } else { this.setResponseBody(responseText); } @@ -1047,7 +1048,7 @@ exports.parseURL = parseURL; exports.DEFAULT_USER_AGENT = DEFAULT_USER_AGENT; exports.defaultUserAgent = DEFAULT_USER_AGENT; // compatible with the specific case -exports.VERSIONINFO = "HTTP request module (http.js) version 0.7.18"; +exports.VERSIONINFO = "HTTP request module (http.js) version 0.7.19"; exports.AUTHOR = "abuse@catswords.net"; exports.global = global; exports.require = global.require;