spacewander commented on a change in pull request #2221:
URL: https://github.com/apache/apisix/pull/2221#discussion_r551660428



##########
File path: apisix/utils/log-util.lua
##########
@@ -64,7 +66,10 @@ local function get_full_log(ngx, conf)
         else
             local body_file = ngx.req.get_body_file()
             if body_file then
-                log.request.body_file = body_file
+                local file = open(body_file, "rb")
+                local content = file:read "*a"
+                file:close()
+                log.request.body_file = content

Review comment:
       We should use a new field to store the content to avoid break change.

##########
File path: apisix/utils/log-util.lua
##########
@@ -64,7 +66,10 @@ local function get_full_log(ngx, conf)
         else
             local body_file = ngx.req.get_body_file()
             if body_file then
-                log.request.body_file = body_file
+                local file = open(body_file, "rb")

Review comment:
       Need to check if `open` is successful to handle something like disk 
problem.

##########
File path: apisix/utils/log-util.lua
##########
@@ -64,7 +66,10 @@ local function get_full_log(ngx, conf)
         else
             local body_file = ngx.req.get_body_file()
             if body_file then
-                log.request.body_file = body_file
+                local file = open(body_file, "rb")
+                local content = file:read "*a"

Review comment:
       Need to check if `read` is successful like `local content, err = 
file:read "*a"`




----------------------------------------------------------------
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.

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


Reply via email to