@@ -50,15 +50,20 @@ local function execute_request(signed_request)
50
50
tostring (err ))
51
51
end
52
52
53
+ local body , body_reader
53
54
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
62
67
end
63
68
end
64
69
end
@@ -82,7 +87,8 @@ local function execute_request(signed_request)
82
87
status = response .status ,
83
88
reason = response .reason ,
84
89
headers = response .headers ,
85
- body = body
90
+ body = body ,
91
+ body_reader = body_reader ,
86
92
}
87
93
end
88
94
0 commit comments