Commit 96e76903 authored by catch's avatar catch
Browse files

Revert "Issue #3202145 by kuldeep_mehra27, phenaproxima, bkosborne, Chris...

Revert "Issue #3202145 by kuldeep_mehra27, phenaproxima, bkosborne, Chris Burge: oEmbed resource fetcher needs to set a reasonable connection timeout"

This reverts commit e6f76d6b.
parent 1edd0d62
......@@ -7,7 +7,6 @@
use Drupal\Core\Cache\UseCacheBackendTrait;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\TransferException;
use GuzzleHttp\RequestOptions;
/**
* Fetches and caches oEmbed resources.
......@@ -59,9 +58,7 @@ public function fetchResource($url) {
}
try {
$response = $this->httpClient->request('GET', $url, [
RequestOptions::TIMEOUT => 5,
]);
$response = $this->httpClient->get($url);
}
catch (TransferException $e) {
throw new ResourceException('Could not retrieve the oEmbed resource.', $url, [], $e);
......
......@@ -10,7 +10,6 @@
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\RequestOptions;
/**
* @group media
......@@ -19,34 +18,6 @@
*/
class ResourceFetcherTest extends UnitTestCase {
/**
* Tests that resources are fetched with a hard-coded timeout.
*/
public function testFetchTimeout(): void {
$url = 'https://example.com/oembed?url=resource';
$headers = [
'Content-Type' => ['text/javascript'],
];
$body = Json::encode([
'version' => '1.0',
'type' => 'video',
'html' => 'test',
]);
$response = new Response(200, $headers, $body);
$client = $this->prophesize(Client::class);
$client->request('GET', $url, [RequestOptions::TIMEOUT => 5])
->shouldBeCalled()
->willReturn($response);
$fetcher = new ResourceFetcher(
$client->reveal(),
$this->createMock('\Drupal\media\OEmbed\ProviderRepositoryInterface'),
new NullBackend('default')
);
$fetcher->fetchResource($url);
}
/**
* Tests how the resource fetcher handles unknown Content-Type headers.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment