Skip to content

Commit 8d7ce58

Browse files
[7.x] Prevent interaction with Http::preventStrayRequests (#1052)
* use Guzzle directly * StyleCI: remove unused import * Throw exception for invalid responses * styleci * Update ChromeDriverCommand.php --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent d7c536a commit 8d7ce58

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/Console/ChromeDriverCommand.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use GuzzleHttp\Client;
77
use GuzzleHttp\Psr7\Utils;
88
use Illuminate\Console\Command;
9-
use Illuminate\Support\Facades\Http;
109
use Illuminate\Support\Str;
1110
use Laravel\Dusk\OperatingSystem;
1211
use Symfony\Component\Process\Process;
@@ -308,13 +307,23 @@ protected function resolveChromeDriverDownloadUrl(string $version, string $os)
308307
* Get the contents of a URL using the 'proxy' and 'ssl-no-verify' command options.
309308
*
310309
* @return string
310+
*
311+
* @throws Exception
311312
*/
312313
protected function getUrl(string $url)
313314
{
314-
return Http::withOptions(array_merge([
315+
$client = new Client();
316+
317+
$response = $client->get($url, array_merge([
315318
'verify' => $this->option('ssl-no-verify') === false,
316319
], array_filter([
317320
'proxy' => $this->option('proxy'),
318-
])))->get($url)->body();
321+
])));
322+
323+
if ($response->getStatusCode() < 200 || $response->getStatusCode() > 299) {
324+
throw new Exception("Unable to fetch contents from [{$url}].");
325+
}
326+
327+
return (string) $response->getBody();
319328
}
320329
}

0 commit comments

Comments
 (0)