diff --git a/src/resty/aws/request/execute.lua b/src/resty/aws/request/execute.lua index 60e0171..02236d6 100644 --- a/src/resty/aws/request/execute.lua +++ b/src/resty/aws/request/execute.lua @@ -55,15 +55,17 @@ local function execute_request(signed_request) if response.headers["application/vnd.amazon.eventstream"] then body_reader = response.body_reader else - body do + local this_body do if response.has_body then - body, err = response:read_body() - if not body then + this_body, err = response:read_body() + if not this_body then return nil, ("failed reading response body from '%s:%s': %s"):format( tostring(signed_request.host), tostring(signed_request.port), tostring(err)) end + + body = this_body end end end