← All changes
|
includes/sdk/s3/Aws/Api/Serializer/QuerySerializer.php
+5
-5
1.2.13
→
1.4.1
View file →
| @@ -18,9 +18,9 @@ | ||
| 18 | 18 | use EndpointV2SerializerTrait; |
| 19 | 19 | private $endpoint; |
| 20 | 20 | private $api; |
| 21 | 21 | private $paramBuilder; |
| 22 | - public function __construct(Service $api, $endpoint, callable $paramBuilder = null) | |
| 22 | + public function __construct(Service $api, $endpoint, ?callable $paramBuilder = null) | |
| 23 | 23 | { |
| 24 | 24 | $this->api = $api; |
| 25 | 25 | $this->endpoint = $endpoint; |
| 26 | 26 | $this->paramBuilder = $paramBuilder ?: new QueryParamBuilder(); |
| @@ -29,11 +29,9 @@ | ||
| 29 | 29 | * When invoked with an AWS command, returns a serialization array |
| 30 | 30 | * containing "method", "uri", "headers", and "body" key value pairs. |
| 31 | 31 | * |
| 32 | 32 | * @param CommandInterface $command Command to serialize into a request. |
| 33 | - * @param $endpointProvider Provider used for dynamic endpoint resolution. | |
| 34 | - * @param $clientArgs Client arguments used for dynamic endpoint resolution. | |
| 35 | - * | |
| 33 | + * @param null $endpoint Endpoint resolved using EndpointProviderV2 | |
| 36 | 34 | * @return RequestInterface |
| 37 | 35 | */ |
| 38 | 36 | public function __invoke(CommandInterface $command, $endpoint = null) |
| 39 | 37 | { |
| @@ -45,10 +43,12 @@ | ||
| 45 | 43 | $body += \call_user_func($this->paramBuilder, $operation->getInput(), $commandArgs); |
| 46 | 44 | } |
| 47 | 45 | $body = \http_build_query($body, '', '&', \PHP_QUERY_RFC3986); |
| 48 | 46 | $headers = ['Content-Length' => \strlen($body), 'Content-Type' => 'application/x-www-form-urlencoded']; |
| 47 | + $requestUri = $operation['http']['requestUri'] ?? null; | |
| 49 | 48 | if ($endpoint instanceof RulesetEndpoint) { |
| 50 | 49 | $this->setEndpointV2RequestOptions($endpoint, $headers); |
| 51 | 50 | } |
| 52 | - return new Request('POST', $this->endpoint, $headers, $body); | |
| 51 | + $absoluteUri = \str_ends_with($this->endpoint, '/') ? $this->endpoint : $this->endpoint . $requestUri; | |
| 52 | + return new Request('POST', $absoluteUri, $headers, $body); | |
| 53 | 53 | } |
| 54 | 54 | } |