- WIP on request/response handling

This commit is contained in:
mcndave committed 2023-10-30 15:21:01 +00:00
1 parent 5d9c0f0dbf
commit 7e93e57515
10 files changed
+133 -121

No files matched your search

+4 -4
View File
@@ -8,9 +8,9 @@ use Ulmus\Api\Common\HttpHeaderEnum;
use Ulmus\Api\Stream\Stream;
use Ulmus\Api\Common\StreamOutputInterface;
class JsonStream extends Stream implements StreamOutputInterface
class JsonStream extends Stream
{
public const DEFAULT_JSON_ENCODING_FLAGS = JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES;
public const DEFAULT_JSON_ENCODING_FLAGS = JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR;
public const DEFAULT_JSON_DECODING_FLAGS = JSON_THROW_ON_ERROR;
@@ -37,13 +37,13 @@ class JsonStream extends Stream implements StreamOutputInterface
public static function fromJsonEncoded(string $json) : StreamInterface
{
$obj = Stream::fromTemp($json);
$obj = static::fromTemp($json);
$obj->rewind();
return $obj;
}
public function render(): mixed
public function decode(): mixed
{
return json_decode($this->getContents(), true, $this->depth, $this->decodingOptions);
}