Repository navigation
Conversation
The generated client called \GuzzleHttp\json_encode() and \GuzzleHttp\Psr7\build_query(). psr7 2 already dropped build_query (iFixit has been monkeypatching it back) and Guzzle 8 drops json_encode, so use json_encode with JSON_THROW_ON_ERROR and Psr7\Query::build, which work on Guzzle 7 and 8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Guzzle 8 only has getResponse() on ResponseException, so a request that failed without a response (a garbled reply, a cert or rewind error) hit an undefined method instead of becoming an ApiException. It also attaches the partial 200 response to a transfer that times out or drops mid-body, which we were reporting as an API answer with status 200. HTTP error responses still carry their status, headers and body. Any other failed transfer is now code 0 with the Guzzle exception as its previous, so callers can tell it apart and decide whether to retry. Connection errors and timeouts before a response still aren't wrapped, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🤖 QA by ClaudeRan on cominor ( Tested
Not tested
Manual changes applied |
|
LGTM. CR 📱 QA 📱 |
🤖
iFixit is moving to Guzzle 8 in iFixit/ifixit#65442, and this client breaks on it. Some requests fail without a full response, like a garbled reply or a cert error. The client asks Guzzle for the response anyway, and on Guzzle 8 that's a fatal error instead of an
ApiException. A request that times out halfway through the body also comes back as anApiExceptionwith status 200, so our retry code thinks Encompass answered.Changes
\GuzzleHttp\json_encode()is gone in Guzzle 8 and\GuzzleHttp\Psr7\build_query()has been gone since psr7 2 (iFixit monkeypatches it back). Nowjson_encode(..., JSON_THROW_ON_ERROR)andPsr7\Query::build(), which work on both.ApiExceptioncode 0 with the Guzzle exception asgetPrevious(). Connection errors and timeouts before a response still aren't wrapped, same as before.The code is generated by swagger-codegen and the templates aren't in this repo, so rerunning
build.shwould undo this.What each failure becomes, sync call (async matches)
From a local server,
timeout => 1:ApiException(400)+ bodyApiException(500)+ bodyConnectExceptionConnectExceptionConnectExceptionNetworkTimeoutExceptionConnectExceptionApiException(200), empty bodyConnectException; 8:ApiException(0), previousResponseTimeoutExceptionApiException(200), empty bodyApiException(200), empty bodyApiException(0), previousRequestException(7) /ResponseTransferException(8)ApiException(0)Error: undefined methodgetResponse()ApiException(0), previousRequestExceptionQA
vendor/bin/phpcs --standard=ruleset.xml EncompassAPI/passes.🤖 Generated with Claude Code