Settings: JsonFormat::decode() expects string not StreamInterface

JsonFormat::decode() expects the content to decode as a string not a
StreamInterface but Response::getBody() will return a StreamInterface.

This was caught by phan as a PhanTypeMismatchArgument error. This patch
fixes it by calling getContents() which returns the remaining content
as a string.

Change-Id: I2ca03f06e7b481ccf19e1c39fa0002b4405ef23a
This commit is contained in:
Derick Alangi 2023-04-04 14:56:05 +01:00
parent 584c2d0967
commit 3eff7189dd

View file

@ -240,7 +240,7 @@ class EtcdSource implements CacheableSource {
$settings = [];
try {
$resp = $this->format->decode( $response->getBody() );
$resp = $this->format->decode( $response->getBody()->getContents() );
if (
!isset( $resp['node'] ) || !is_array( $resp['node'] )