- 🇬🇧United Kingdom joachim
The problem is that we reach Utils::streamFor() with $resource as an empty array.
That comes from this in ApiClient::handle(), where $body is an empty array:
// If no provider was given. execute the request directly. $psrRequest = new Request( $request->getMethod() ?: $this->defaultMethod, $this->baseUri . $request->getEndpoint(), $headers, $body );
and in turn, that $body that's an empty array by default comes from BaseRequest:
/** * @var array */ protected $body = [];
The reason this is a problem specific to BasicAuth is the BasicAuthUnomiConnector plugin calling this in GuzzleApiClientFactory::createBasicAuth():
return new ApiClient(null, $psrClient, null, $config);
The first NULL is the $provider parameter to ApiClient::__construct().
Further down in ApiClient there is branching whether $this->provider is set, and only if $this->provider is empty we do this:
$psrRequest = new Request( $request->getMethod() ?: $this->defaultMethod, $this->baseUri . $request->getEndpoint(), $headers, $body );
and $body is an empty array.
- 🇬🇧United Kingdom joachim
Fixed in this fork branch: https://gitlab.com/joachim-n/unomi-sdk-php/-/commits/3314799-body-array-... -- but the main repo https://gitlab.com/dropsolid/unomi-sdk-php/ doesn't seem to allow MRs.
- 🇬🇧United Kingdom joachim
Made a MR in my fork -- https://gitlab.com/joachim-n/unomi-sdk-php/-/merge_requests/1
It's not particularly useful, but gives us a diff: https://gitlab.com/joachim-n/unomi-sdk-php/-/merge_requests/1.diff
- Status changed to Fixed
over 1 year ago 5:14pm 2 August 2023 - 🇧🇪Belgium Grayle
Added the same check in library
https://gitlab.com/dropsolid/unomi-sdk-php/-/blob/php8/src/Http/ApiClien...
Latest release(s) uses updated library. See updates section on main page for info on the new versions.
Automatically closed - issue fixed for 2 weeks with no activity.