Skip to content

Commit

Permalink
fix: evaluate streaming for s3 200 error
Browse files Browse the repository at this point in the history
Make sure that operations where any of its member has an eventstream or streaming trait are ignored.
  • Loading branch information
yenfryherrerafeliz committed Aug 8, 2024
1 parent c8baf4f commit 80a195c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/S3/Parser/S3Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 80a195c

Please sign in to comment.