mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-02 21:19:58 +09:00
Update to laravel 7
This commit is contained in:
14
vendor/symfony/http-kernel/HttpClientKernel.php
vendored
14
vendor/symfony/http-kernel/HttpClientKernel.php
vendored
@@ -21,6 +21,9 @@ use Symfony\Component\Mime\Part\Multipart\FormDataPart;
|
||||
use Symfony\Component\Mime\Part\TextPart;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
// Help opcache.preload discover always-needed symbols
|
||||
class_exists(ResponseHeaderBag::class);
|
||||
|
||||
/**
|
||||
* An implementation of a Symfony HTTP kernel using a "real" HTTP client.
|
||||
*
|
||||
@@ -32,14 +35,14 @@ final class HttpClientKernel implements HttpKernelInterface
|
||||
|
||||
public function __construct(HttpClientInterface $client = null)
|
||||
{
|
||||
if (!class_exists(HttpClient::class)) {
|
||||
if (null === $client && !class_exists(HttpClient::class)) {
|
||||
throw new \LogicException(sprintf('You cannot use "%s" as the HttpClient component is not installed. Try running "composer require symfony/http-client".', __CLASS__));
|
||||
}
|
||||
|
||||
$this->client = $client ?? HttpClient::create();
|
||||
}
|
||||
|
||||
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
|
||||
public function handle(Request $request, int $type = HttpKernelInterface::MAIN_REQUEST, bool $catch = true): Response
|
||||
{
|
||||
$headers = $this->getHeaders($request);
|
||||
$body = '';
|
||||
@@ -50,13 +53,16 @@ final class HttpClientKernel implements HttpKernelInterface
|
||||
$response = $this->client->request($request->getMethod(), $request->getUri(), [
|
||||
'headers' => $headers,
|
||||
'body' => $body,
|
||||
'max_redirects' => 0,
|
||||
] + $request->attributes->get('http_client_options', []));
|
||||
|
||||
$response = new Response($response->getContent(!$catch), $response->getStatusCode(), $response->getHeaders(!$catch));
|
||||
|
||||
$response->headers->remove('X-Body-File');
|
||||
$response->headers->remove('X-Body-Eval');
|
||||
$response->headers->remove('X-Content-Digest');
|
||||
|
||||
$response->headers = new class($response->headers->all()) extends ResponseHeaderBag {
|
||||
protected function computeCacheControlValue()
|
||||
protected function computeCacheControlValue(): string
|
||||
{
|
||||
return $this->getCacheControlHeader(); // preserve the original value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user