@@ -50,15 +50,20 @@ local function execute_request(signed_request)
5050 tostring (err ))
5151 end
5252
53+ local body , body_reader
5354
54- local body do
55- if response .has_body then
56- body , err = response :read_body ()
57- if not body then
58- return nil , (" failed reading response body from '%s:%s': %s" ):format (
59- tostring (signed_request .host ),
60- tostring (signed_request .port ),
61- tostring (err ))
55+ if response .headers [" application/vnd.amazon.eventstream" ] then
56+ body_reader = response .body_reader
57+ else
58+ body do
59+ if response .has_body then
60+ body , err = response :read_body ()
61+ if not body then
62+ return nil , (" failed reading response body from '%s:%s': %s" ):format (
63+ tostring (signed_request .host ),
64+ tostring (signed_request .port ),
65+ tostring (err ))
66+ end
6267 end
6368 end
6469 end
@@ -82,7 +87,8 @@ local function execute_request(signed_request)
8287 status = response .status ,
8388 reason = response .reason ,
8489 headers = response .headers ,
85- body = body
90+ body = body ,
91+ body_reader = body_reader ,
8692 }
8793end
8894
0 commit comments