Skip to content

Commit 3e9f57f

Browse files
authored
Allow StaticResource to be used with another Filesystem (#20)
Signed-off-by: Theo Gotsopoulos <theogpl57@gmail.com>
1 parent b875ef3 commit 3e9f57f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/StaticResource.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Amp\Http\Server\StaticContent;
44

5+
use Amp\File\Filesystem;
56
use Amp\ForbidCloning;
67
use Amp\ForbidSerialization;
78
use Amp\Http\Server\ErrorHandler;
@@ -23,13 +24,13 @@ final class StaticResource implements RequestHandler
2324
* @param string $path Path to static resource to serve. This resource will always be served, regardless of the
2425
* request URI.
2526
*/
26-
public function __construct(HttpServer $server, ErrorHandler $errorHandler, string $path)
27+
public function __construct(HttpServer $server, ErrorHandler $errorHandler, string $path, ?Filesystem $filesystem = null)
2728
{
2829
$path = removeDotPathSegments($path);
2930
$root = \dirname($path);
3031
$this->path = '/' . \basename($path);
3132

32-
$this->documentRoot = new DocumentRoot($server, $errorHandler, $root);
33+
$this->documentRoot = new DocumentRoot($server, $errorHandler, $root, $filesystem);
3334
}
3435

3536
public function handleRequest(Request $request): Response

0 commit comments

Comments
 (0)