PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
← All changes | includes/sdk/s3/Aws/Api/Serializer/RestJsonSerializer.php +4 -3 1.2.13 → 1.4.2 View file →
@@ -18,17 +18,18 @@
18 18 * @param Service $api Service API description
19 19 * @param string $endpoint Endpoint to connect to
20 20 * @param JsonBody $jsonFormatter Optional JSON formatter to use
21 21 */
22 - public function __construct(Service $api, $endpoint, JsonBody $jsonFormatter = null)
22 + public function __construct(Service $api, $endpoint, ?JsonBody $jsonFormatter = null)
23 23 {
24 24 parent::__construct($api, $endpoint);
25 25 $this->contentType = JsonBody::getContentType($api);
26 26 $this->jsonFormatter = $jsonFormatter ?: new JsonBody($api);
27 27 }
28 - protected function payload(StructureShape $member, array $value, array &$opts)
28 + protected function payload(StructureShape $member, array|string $value, array &$opts)
29 29 {
30 - $body = isset($value) ? (string) $this->jsonFormatter->build($member, $value) : "{}";
31 30 $opts['headers']['Content-Type'] = $this->contentType;
31 + $body = $this->jsonFormatter->build($member, $value);
32 + $opts['headers']['Content-Length'] = \strlen($body);
32 33 $opts['body'] = $body;
33 34 }
34 35 }