Skip to content

Commit 1f7b7bd

Browse files
committed
feat: allows object and array when unserializing
1 parent adfcd5f commit 1f7b7bd

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Providers/Http/DTO/Request.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,9 @@ public static function getJsonSchema(): array
307307
'description' => 'The request headers.',
308308
],
309309
self::KEY_BODY => [
310-
'type' => ['string', 'null'],
311-
'description' => 'The request body.',
310+
'type' => ['string', 'array', 'object', 'null'],
311+
'description' => 'The request body. Always a string when serialized. ' .
312+
'Can be a string, array, or object when deserializing.',
312313
],
313314
],
314315
'required' => [self::KEY_METHOD, self::KEY_URI, self::KEY_HEADERS],

src/Providers/Http/HttpTransporter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,10 @@ private function convertFromPsr7Response(ResponseInterface $psr7Response): Respo
117117
{
118118
$body = (string) $psr7Response->getBody();
119119

120+
// PSR-7 always returns headers as arrays, but HeadersCollection handles this
120121
return new Response(
121122
$psr7Response->getStatusCode(),
122-
$psr7Response->getHeaders(), // @phpstan-ignore-line PSR-7 always returns headers as arrays, but HeadersCollection handles this
123+
$psr7Response->getHeaders(), // @phpstan-ignore-line
123124
$body === '' ? null : $body
124125
);
125126
}

0 commit comments

Comments
 (0)