starsz commented on a change in pull request #2965:
URL: https://github.com/apache/apisix/pull/2965#discussion_r548829689
##########
File path: apisix/cli/etcd.lua
##########
@@ -179,14 +179,14 @@ function _M.init(env, show_output)
local post_json_auth = dkjson.encode(json_auth)
local response_body = {}
- local _, err = http.request{url = auth_url, method = "POST",
+ local res, err = http.request{url = auth_url, method = "POST",
source =
ltn12.source.string(post_json_auth),
sink = ltn12.sink.table(response_body),
headers = {["Content-Length"] =
#post_json_auth}}
-- In case of failure, request returns nil followed by an error
message.
-- Else the first return value is just the number 1
Review comment:
Yep. It has two forms.
You can see more details about it.
>In case of failure, the function returns nil followed by an error message.
If successful, the simple form returns the response body as a string, followed
by the response status code, the response headers, and the response status
line. The generic function returns the same information, except the first
return value is just the number 1 (the body goes to the sink).
http://w3.impa.br/~diego/software/luasocket/http.html
##########
File path: apisix/cli/etcd.lua
##########
@@ -179,14 +179,14 @@ function _M.init(env, show_output)
local post_json_auth = dkjson.encode(json_auth)
local response_body = {}
- local _, err = http.request{url = auth_url, method = "POST",
+ local res, err = http.request{url = auth_url, method = "POST",
source =
ltn12.source.string(post_json_auth),
sink = ltn12.sink.table(response_body),
headers = {["Content-Length"] =
#post_json_auth}}
-- In case of failure, request returns nil followed by an error
message.
-- Else the first return value is just the number 1
Review comment:
Yep. It has two forms.
You can see more details about it.
>In case of failure, the function returns nil followed by an error message.
If successful, the simple form returns the response body as a string, followed
by the response status code, the response headers and the response status line.
The generic function returns the same information, except the first return
value is just the number 1 (the body goes to the sink).
http://w3.impa.br/~diego/software/luasocket/http.html
----------------------------------------------------------------
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]