diff --git a/src/Flysystem/Adapter/FedoraAdapter.php b/src/Flysystem/Adapter/FedoraAdapter.php index 6ee588b5..58be909c 100644 --- a/src/Flysystem/Adapter/FedoraAdapter.php +++ b/src/Flysystem/Adapter/FedoraAdapter.php @@ -50,7 +50,7 @@ class FedoraAdapter implements AdapterInterface { * {@inheritdoc} */ public function has($path) { - $response = $this->fedora->getResourceHeaders($path); + $response = $this->fedora->getResourceHeaders($path, ['Connection' => 'close']); return $response->getStatusCode() == 200; } @@ -77,7 +77,7 @@ class FedoraAdapter implements AdapterInterface { * {@inheritdoc} */ public function readStream($path) { - $response = $this->fedora->getResource($path); + $response = $this->fedora->getResource($path, ['Connection' => 'close']); if ($response->getStatusCode() != 200) { return FALSE; @@ -96,7 +96,7 @@ class FedoraAdapter implements AdapterInterface { * {@inheritdoc} */ public function getMetadata($path) { - $response = $this->fedora->getResourceHeaders($path); + $response = $this->fedora->getResourceHeaders($path, ['Connection' => 'close']); if ($response->getStatusCode() != 200) { return FALSE; @@ -184,7 +184,10 @@ class FedoraAdapter implements AdapterInterface { return []; } // Get the resource from Fedora. - $response = $this->fedora->getResource($normalized, ['Accept' => 'application/ld+json']); + $response = $this->fedora->getResource($normalized, [ + 'Accept' => 'application/ld+json', + 'Connection' => 'close', + ]); $jsonld = (string) $response->getBody(); $graph = json_decode($jsonld, TRUE); @@ -379,7 +382,7 @@ class FedoraAdapter implements AdapterInterface { * NULL if no tombstone, TRUE if tombstone deleted, FALSE otherwise. */ private function deleteTombstone($path) { - $response = $this->fedora->getResourceHeaders($path); + $response = $this->fedora->getResourceHeaders($path, ['Connection' => 'close']); $return = NULL; if ($response->getStatusCode() == 410) { $return = FALSE; diff --git a/tests/src/Kernel/FedoraAdapterTest.php b/tests/src/Kernel/FedoraAdapterTest.php index 7ba00232..10c5beb1 100644 --- a/tests/src/Kernel/FedoraAdapterTest.php +++ b/tests/src/Kernel/FedoraAdapterTest.php @@ -51,8 +51,8 @@ class FedoraAdapterTest extends IslandoraKernelTestBase { $response = $prophecy->reveal(); $prophecy = $this->prophesize(IFedoraApi::class); - $prophecy->getResourceHeaders('')->willReturn($response); - $prophecy->getResource('')->willReturn($response); + $prophecy->getResourceHeaders('', ['Connection' => 'close'])->willReturn($response); + $prophecy->getResource('', ['Connection' => 'close'])->willReturn($response); $api = $prophecy->reveal(); $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class) @@ -69,8 +69,8 @@ class FedoraAdapterTest extends IslandoraKernelTestBase { $response = $prophecy->reveal(); $prophecy = $this->prophesize(IFedoraApi::class); - $prophecy->getResourceHeaders('')->willReturn($response); - $prophecy->getResource('')->willReturn($response); + $prophecy->getResourceHeaders('', ['Connection' => 'close'])->willReturn($response); + $prophecy->getResource('', ['Connection' => 'close'])->willReturn($response); $api = $prophecy->reveal(); $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class) @@ -95,7 +95,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase { $response = $prophecy->reveal(); $prophecy = $this->prophesize(IFedoraApi::class); - $prophecy->getResourceHeaders('')->willReturn($response); + $prophecy->getResourceHeaders('', ['Connection' => 'close'])->willReturn($response); $api = $prophecy->reveal(); $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class) @@ -122,7 +122,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase { $prophecy = $this->createAdapterBase(); - $fedora_prophecy->getResourceHeaders('')->willReturn($prophecy->reveal()); + $fedora_prophecy->getResourceHeaders('', ['Connection' => 'close'])->willReturn($prophecy->reveal()); $api = $fedora_prophecy->reveal(); @@ -139,7 +139,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase { $fedora_prophecy = $this->prophesize(IFedoraApi::class); $prophecy = $this->prophesize(Response::class); $prophecy->getStatusCode()->willReturn(500); - $fedora_prophecy->getResourceHeaders('')->willReturn($prophecy->reveal()); + $fedora_prophecy->getResourceHeaders('', ['Connection' => 'close'])->willReturn($prophecy->reveal()); $prophecy = $this->prophesize(Response::class); $prophecy->getStatusCode()->willReturn(500); @@ -176,7 +176,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase { ';rel="type"', ]); - $fedora_prophecy->getResourceHeaders('')->willReturn($prophecy->reveal()); + $fedora_prophecy->getResourceHeaders('', ['Connection' => 'close'])->willReturn($prophecy->reveal()); $api = $fedora_prophecy->reveal(); @@ -196,7 +196,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase { $prophecy->getStatusCode()->willReturn(204); $fedora_prophecy->deleteResource('')->willReturn($prophecy->reveal()); - $fedora_prophecy->getResourceHeaders('')->willReturn($prophecy->reveal()); + $fedora_prophecy->getResourceHeaders('', ['Connection' => 'close'])->willReturn($prophecy->reveal()); $api = $fedora_prophecy->reveal(); $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class) @@ -242,7 +242,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase { $tombstone_prophecy->getStatusCode()->willReturn(204); $fedora_prophecy->deleteResource('')->willReturn($prophecy->reveal()); - $fedora_prophecy->getResourceHeaders('') + $fedora_prophecy->getResourceHeaders('', ['Connection' => 'close']) ->willReturn($head_prophecy->reveal()); $fedora_prophecy->deleteResource('some-path-to-a-tombstone') ->willReturn($tombstone_prophecy->reveal()); @@ -273,7 +273,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase { $tombstone_prophecy->getStatusCode()->willReturn(500); $fedora_prophecy->deleteResource('')->willReturn($prophecy->reveal()); - $fedora_prophecy->getResourceHeaders('') + $fedora_prophecy->getResourceHeaders('', ['Connection' => 'close']) ->willReturn($head_prophecy->reveal()); $fedora_prophecy->deleteResource('some-path-to-a-tombstone') ->willReturn($tombstone_prophecy->reveal()); @@ -606,7 +606,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase { $response = $prophecy->reveal(); $fedora_prophecy = $this->prophesize(IFedoraApi::class); - $fedora_prophecy->getResource(Argument::any())->willReturn($response); + $fedora_prophecy->getResource(Argument::any(), ['Connection' => 'close'])->willReturn($response); $prophecy = $this->prophesize(Response::class); $prophecy->getStatusCode()->willReturn(201); @@ -633,7 +633,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase { $prophecy->getHeader('Content-Length')->willReturn([strlen("DERP")]); $response = $prophecy->reveal(); - $fedora_prophecy->getResourceHeaders(Argument::any()) + $fedora_prophecy->getResourceHeaders(Argument::any(), ['Connection' => 'close']) ->willReturn($response); $prophecy = $this->prophesize(Response::class);