This is an automated email from the ASF dual-hosted git repository.

baoyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 301670a12 fix(ai-prompt-template): fix malformed JSON error message 
(#13096)
301670a12 is described below

commit 301670a12b519eecc3f487145f7df33c241e3faa
Author: Sihyeon Jang <[email protected]>
AuthorDate: Thu Apr 16 13:20:40 2026 +0900

    fix(ai-prompt-template): fix malformed JSON error message (#13096)
---
 apisix/core/request.lua                | 2 +-
 apisix/plugins/ai-prompt-decorator.lua | 2 +-
 apisix/plugins/ai-prompt-template.lua  | 2 +-
 t/plugin/ai-proxy-multi.t              | 2 +-
 t/plugin/ai-proxy.t                    | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/apisix/core/request.lua b/apisix/core/request.lua
index fef4bf17e..3db323d48 100644
--- a/apisix/core/request.lua
+++ b/apisix/core/request.lua
@@ -343,7 +343,7 @@ function _M.get_json_request_body_table()
 
     local body_tab, err = json.decode(body)
     if not body_tab then
-        return nil, { message = "could not get parse JSON request body: " .. 
err }
+        return nil, { message = "could not parse JSON request body: " .. err }
     end
 
     return body_tab
diff --git a/apisix/plugins/ai-prompt-decorator.lua 
b/apisix/plugins/ai-prompt-decorator.lua
index f50c3c7d9..800846e2a 100644
--- a/apisix/plugins/ai-prompt-decorator.lua
+++ b/apisix/plugins/ai-prompt-decorator.lua
@@ -72,7 +72,7 @@ local function get_request_body_table()
 
     local body_tab, err = core.json.decode(body)
     if not body_tab then
-        return nil, { message = "could not get parse JSON request body: " .. 
err }
+        return nil, { message = "could not parse JSON request body: " .. err }
     end
 
     return body_tab
diff --git a/apisix/plugins/ai-prompt-template.lua 
b/apisix/plugins/ai-prompt-template.lua
index b21826e6b..8ca0eaf8f 100644
--- a/apisix/plugins/ai-prompt-template.lua
+++ b/apisix/plugins/ai-prompt-template.lua
@@ -98,7 +98,7 @@ local function get_request_body_table()
 
     local body_tab, err = core.json.decode(body)
     if not body_tab then
-        return nil, { message = "could not get parse JSON request body: ", err 
}
+        return nil, { message = "could not parse JSON request body: " .. err }
     end
 
     return body_tab
diff --git a/t/plugin/ai-proxy-multi.t b/t/plugin/ai-proxy-multi.t
index faacdecee..a9ba19797 100644
--- a/t/plugin/ai-proxy-multi.t
+++ b/t/plugin/ai-proxy-multi.t
@@ -345,7 +345,7 @@ GET /anything
 {}"messages": [ { "role": "system", "cont
 --- error_code: 400
 --- response_body
-{"message":"could not get parse JSON request body: Expected the end but found 
T_STRING at character 3"}
+{"message":"could not parse JSON request body: Expected the end but found 
T_STRING at character 3"}
 
 
 
diff --git a/t/plugin/ai-proxy.t b/t/plugin/ai-proxy.t
index 4527a74bd..bf95ba3c5 100644
--- a/t/plugin/ai-proxy.t
+++ b/t/plugin/ai-proxy.t
@@ -459,7 +459,7 @@ GET /anything
 {}"messages": [ { "role": "system", "cont
 --- error_code: 400
 --- response_body
-{"message":"could not get parse JSON request body: Expected the end but found 
T_STRING at character 3"}
+{"message":"could not parse JSON request body: Expected the end but found 
T_STRING at character 3"}
 
 
 

Reply via email to