From cbd40a454899804bc5cd31a1c4798b2b163ecdc5 Mon Sep 17 00:00:00 2001 From: Jack Tysoe Date: Thu, 6 Jun 2024 10:29:26 +0100 Subject: [PATCH] fix(*): variable scope --- src/resty/aws/request/execute.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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