From 80a195cad17fba44b6502b6b8da5d8416cfd4d35 Mon Sep 17 00:00:00 2001 From: Yenfry Herrera Feliz Date: Thu, 8 Aug 2024 09:55:54 -0700 Subject: [PATCH] fix: evaluate streaming for s3 200 error Make sure that operations where any of its member has an eventstream or streaming trait are ignored. --- src/S3/Parser/S3Parser.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/S3/Parser/S3Parser.php b/src/S3/Parser/S3Parser.php index fc838997e2..a9cfd0dcb5 100644 --- a/src/S3/Parser/S3Parser.php +++ b/src/S3/Parser/S3Parser.php @@ -95,7 +95,7 @@ private function parse200Error(CommandInterface $command, ResponseInterface $res { // This error parsing should be just for 200 error responses and operations where its output shape // does not have a streaming member. - if (200 !== $response->getStatusCode() || $this->hasStreamingTrait($command->getName())) { + if (200 !== $response->getStatusCode() || !$this->shouldBeConsidered200Error($command->getName())) { return; } @@ -131,23 +131,25 @@ private function parse200Error(CommandInterface $command, ResponseInterface $res } /** - * Checks if a specific operation has a streaming trait. + * Checks if a specific operation should be considered + * a s3 200 error. Operations where any of its output members + * has a streaming or httpPayload trait should be not considered. * * @param $commandName * * @return bool */ - private function hasStreamingTrait($commandName): bool + private function shouldBeConsidered200Error($commandName): bool { $operation = $this->api->getOperation($commandName); $output = $operation->getOutput(); foreach ($output->getMembers() as $_ => $memberProps) { if (!empty($memberProps['eventstream']) || !empty($memberProps['streaming'])) { - return true; + return false; } } - return false; + return true; } /**