moonming commented on code in PR #11629:
URL: https://github.com/apache/apisix/pull/11629#discussion_r1904869662


##########
apisix/plugins/opa/helper.lua:
##########
@@ -45,8 +61,13 @@ local function build_http_request(conf, ctx)
         headers = core.request.headers(ctx),
         query   = core.request.get_uri_args(ctx),
     }
-end
 
+    if conf.with_body then
+        http.body = get_body_for_request()

Review Comment:
   ```suggestion
           local body, err = get_body_for_request()
           if err then
               core.log.warn(err)
           else
               http.body = body
           end
   ```



##########
apisix/plugins/opa/helper.lua:
##########
@@ -34,9 +34,25 @@ local function build_var(conf, ctx)
     }
 end
 
+local function get_body_for_request()
+    local original_body, err = core.request.get_body()
+    if err ~= nil then
+        error("opa - failed to get request body: " .. err)

Review Comment:
   ```suggestion
           return nil, "failed to get request body: " .. err
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to