Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/CodeGenerator/src/Generator/InputGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ private function inputClassRequestGetters(StructureShape $inputShape, ClassBuild
$body['querystring'] = '$query = [];' . "\n";

$usesEndpointDiscovery = $operation->usesEndpointDiscovery();
foreach (['header' => '$headers', 'querystring' => '$query', 'uri' => '$uri'] as $requestPart => $varName) {
$requestParts = ['header' => '$headers', 'querystring' => '$query', 'uri' => '$uri'];
foreach ($requestParts as $requestPart => $varName) {
foreach ($inputShape->getMembers() as $member) {
// If location is not specified, it will go in the request body.
if ($requestPart !== $member->getLocation()) {
Expand Down Expand Up @@ -373,9 +374,6 @@ private function inputClassRequestGetters(StructureShape $inputShape, ClassBuild
}
$body[$requestPart] .= $bodyCode . "\n";
}
if (isset($body[$requestPart])) {
$body[$requestPart] = implode("\n", array_filter(array_map('trim', explode("\n", $body[$requestPart]))));
}
}

// "headers" are not "header"
Expand Down Expand Up @@ -406,7 +404,13 @@ private function inputClassRequestGetters(StructureShape $inputShape, ClassBuild
'LOCATION' => $member->getLocationName() ?? $member->getName(),
'VALUE' => $inputElement,
]);
$body['header'] .= implode("\n", array_filter(array_map('trim', explode("\n", $bodyCode))));
$body['header'] .= $bodyCode . "\n";
}

foreach (array_keys($requestParts) as $requestPart) {
if (isset($body[$requestPart])) {
$body[$requestPart] = implode("\n", array_filter(array_map('trim', explode("\n", $body[$requestPart]))));
}
}

if ($operation->hasBody()) {
Expand Down
3 changes: 2 additions & 1 deletion src/Service/S3/src/Input/CopyObjectRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,8 @@ public function request(): Request
}
if (null !== $this->expectedSourceBucketOwner) {
$headers['x-amz-source-expected-bucket-owner'] = $this->expectedSourceBucketOwner;
}if (null !== $this->metadata) {
}
if (null !== $this->metadata) {
foreach ($this->metadata as $key => $value) {
$headers["x-amz-meta-$key"] = $value;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Service/S3/src/Input/CreateMultipartUploadRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,8 @@ public function request(): Request
throw new InvalidArgument(sprintf('Invalid parameter "ChecksumAlgorithm" for "%s". The value "%s" is not a valid "ChecksumAlgorithm".', __CLASS__, $this->checksumAlgorithm));
}
$headers['x-amz-checksum-algorithm'] = $this->checksumAlgorithm;
}if (null !== $this->metadata) {
}
if (null !== $this->metadata) {
foreach ($this->metadata as $key => $value) {
$headers["x-amz-meta-$key"] = $value;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Service/S3/src/Input/PutObjectRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,8 @@ public function request(): Request
}
if (null !== $this->expectedBucketOwner) {
$headers['x-amz-expected-bucket-owner'] = $this->expectedBucketOwner;
}if (null !== $this->metadata) {
}
if (null !== $this->metadata) {
foreach ($this->metadata as $key => $value) {
$headers["x-amz-meta-$key"] = $value;
}
Expand Down