← All changes
|
includes/sdk/s3/Aws/Api/Serializer/JsonRpcSerializer.php
+6
-3
1.2.13
→
1.4.2
View file →
| @@ -27,9 +27,9 @@ | ||
| 27 | 27 | * @param Service $api Service description |
| 28 | 28 | * @param string $endpoint Endpoint to connect to |
| 29 | 29 | * @param JsonBody $jsonFormatter Optional JSON formatter to use |
| 30 | 30 | */ |
| 31 | - public function __construct(Service $api, $endpoint, JsonBody $jsonFormatter = null) | |
| 31 | + public function __construct(Service $api, $endpoint, ?JsonBody $jsonFormatter = null) | |
| 32 | 32 | { |
| 33 | 33 | $this->endpoint = $endpoint; |
| 34 | 34 | $this->api = $api; |
| 35 | 35 | $this->jsonFormatter = $jsonFormatter ?: new JsonBody($this->api); |
| @@ -49,11 +49,14 @@ | ||
| 49 | 49 | { |
| 50 | 50 | $operationName = $command->getName(); |
| 51 | 51 | $operation = $this->api->getOperation($operationName); |
| 52 | 52 | $commandArgs = $command->toArray(); |
| 53 | - $headers = ['X-Amz-Target' => $this->api->getMetadata('targetPrefix') . '.' . $operationName, 'Content-Type' => $this->contentType]; | |
| 53 | + $body = $this->jsonFormatter->build($operation->getInput(), $commandArgs); | |
| 54 | + $headers = ['X-Amz-Target' => $this->api->getMetadata('targetPrefix') . '.' . $operationName, 'Content-Type' => $this->contentType, 'Content-Length' => \strlen($body)]; | |
| 54 | 55 | if ($endpoint instanceof RulesetEndpoint) { |
| 55 | 56 | $this->setEndpointV2RequestOptions($endpoint, $headers); |
| 56 | 57 | } |
| 57 | - return new Request($operation['http']['method'], $this->endpoint, $headers, $this->jsonFormatter->build($operation->getInput(), $commandArgs)); | |
| 58 | + $requestUri = $operation['http']['requestUri'] ?? null; | |
| 59 | + $absoluteUri = \str_ends_with($this->endpoint, '/') ? $this->endpoint : $this->endpoint . $requestUri; | |
| 60 | + return new Request($operation['http']['method'], $absoluteUri, $headers, $body); | |
| 58 | 61 | } |
| 59 | 62 | } |