You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/09/15 01:50:39 UTC
[GitHub] [apisix] membphis commented on a change in pull request #2221: send file contents and not file name
membphis commented on a change in pull request #2221:
URL: https://github.com/apache/apisix/pull/2221#discussion_r488333965
##########
File path: apisix/utils/log-util.lua
##########
@@ -64,7 +64,11 @@ 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 lines = {}
Review comment:
https://stackoverflow.com/questions/11201262/how-to-read-data-from-a-file-in-lua
Read the file content in this way, is the right way:
```lua
local open = io.open
local function read_file(path)
local file = open(path, "rb") -- r read mode and b binary mode
if not file then return nil end
local content = file:read "*a" -- *a or *all reads the whole file
file:close()
return content
end
local fileContent = read_file("foo.html");
print (fileContent);
```
----------------------------------------------------------------
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:
users@infra.apache.org