@@ -67,7 +67,7 @@ private function attachToHttp(
6767 $ tokenCallback
6868 );
6969
70- $ config = $ http -> getConfig ( );
70+ $ config = $ this -> getClientConfig ( $ http );
7171 $ config ['handler ' ]->remove ('google_auth ' );
7272 $ config ['handler ' ]->push ($ middleware , 'google_auth ' );
7373 $ config ['auth ' ] = 'google_auth ' ;
@@ -95,7 +95,7 @@ public function attachToken(ClientInterface $http, array $token, array $scopes)
9595 $ this ->cache
9696 );
9797
98- $ config = $ http -> getConfig ( );
98+ $ config = $ this -> getClientConfig ( $ http );
9999 $ config ['handler ' ]->remove ('google_auth ' );
100100 $ config ['handler ' ]->push ($ middleware , 'google_auth ' );
101101 $ config ['auth ' ] = 'scoped ' ;
@@ -108,7 +108,7 @@ public function attachKey(ClientInterface $http, $key)
108108 {
109109 $ middleware = new SimpleMiddleware (['key ' => $ key ]);
110110
111- $ config = $ http -> getConfig ( );
111+ $ config = $ this -> getClientConfig ( $ http );
112112 $ config ['handler ' ]->remove ('google_auth ' );
113113 $ config ['handler ' ]->push ($ middleware , 'google_auth ' );
114114 $ config ['auth ' ] = 'simple ' ;
@@ -119,6 +119,15 @@ public function attachKey(ClientInterface $http, $key)
119119
120120 private function createAuthHttp (ClientInterface $ http )
121121 {
122- return new Client (['http_errors ' => true ] + $ http ->getConfig ());
122+ return new Client (['http_errors ' => true ] + $ this ->getClientConfig ($ http ));
123+ }
124+
125+ /**
126+ * getConfig() was removed from ClientInterface in Guzzle 8 but remains on
127+ * the concrete Client, which is what these handlers operate on.
128+ */
129+ private function getClientConfig (ClientInterface $ http ): array
130+ {
131+ return $ http instanceof Client ? $ http ->getConfig () : [];
123132 }
124133}
0 commit comments