File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1111 'username ' => env ('ELASTICSEARCH_USERNAME ' , '' ),
1212 'password ' => env ('ELASTICSEARCH_PASSWORD ' , '' ),
1313 'ssl_verification ' => env ('ELASTICSEARCH_SSL_VERIFICATION ' , false ),
14- 'handler ' => null , // for call_user_func_array
14+
15+ 'http_client ' => null , // class implementing the \Psr\Http\Client\ClientInterface
16+ 'http_client_options ' => null , // for call_user_func_array
1517 ],
1618];
Original file line number Diff line number Diff line change @@ -157,8 +157,16 @@ public static function fromConfig(array $config): static
157157 $ builder ->setBasicAuthentication ($ username , $ password );
158158 }
159159
160- if (filled ($ config ['handler ' ] ?? null )) {
161- $ builder ->setHandler (call_user_func_array ($ config ['handler ' ], []));
160+ if (filled ($ config ['http_client ' ] ?? null )) {
161+ $ client = new $ config ['http_client ' ]();
162+
163+ $ builder ->setHttpClient ($ client );
164+ }
165+
166+ if (filled ($ config ['http_client_options ' ] ?? null )) {
167+ $ options = call_user_func_array ($ config ['http_client_options ' ], []);
168+
169+ $ builder ->setHttpClientOptions ($ options );
162170 }
163171
164172 return new static ($ builder ->build ());
You can’t perform that action at this time.
0 commit comments