File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 2020use GuzzleHttp \Exception \RequestException ;
2121use Psr \Http \Message \RequestInterface ;
2222use Psr \Http \Message \ResponseInterface ;
23+ use Psr \Http \Message \Response ;
2324
2425/**
2526 * This class implements the RESTful transport of apiServiceRequest()'s
@@ -77,12 +78,17 @@ public static function doExecute(ClientInterface $client, RequestInterface $requ
7778 throw $ e ;
7879 }
7980
80- $ exceptionResponse = $ e ->getResponse ();
81- if ($ exceptionResponse instanceof \GuzzleHttp \Message \ResponseInterface) {
82- $ exceptionResponse = $ httpHandler ->buildPsr7Response ($ e ->getResponse ());
81+ $ response = $ e ->getResponse ();
82+ // specific checking for Guzzle 5: convert to PSR7 response
83+ if ($ response instanceof \GuzzleHttp \Message \ResponseInterface) {
84+ $ response = new Response (
85+ $ response ->getStatusCode (),
86+ $ response ->getHeaders () ?: [],
87+ $ response ->getBody (),
88+ $ response ->getProtocolVersion (),
89+ $ response ->getReasonPhrase ()
90+ );
8391 }
84-
85- $ response = $ exceptionResponse ;
8692 }
8793
8894 return self ::decodeHttpResponse ($ response , $ request , $ expectedClass );
You can’t perform that action at this time.
0 commit comments