@@ 28-39 (lines=12) @@ | ||
25 | $this->output = $output; |
|
26 | } |
|
27 | ||
28 | public function send404Response(Request $request, Response $response) |
|
29 | { |
|
30 | $this->writeResponse(404, $request->getPath()); |
|
31 | $response->writeHead(404, [ |
|
32 | 'Content-Type' => 'text/html', |
|
33 | ]); |
|
34 | ||
35 | $response->end( |
|
36 | '<h1>404 - Not Found</h1>'. |
|
37 | '<p>Sculpin web server could not find the requested resource.</p>' |
|
38 | ); |
|
39 | } |
|
40 | ||
41 | public function send200Response(Request $request, Response $response, string $path) |
|
42 | { |
|
@@ 41-49 (lines=9) @@ | ||
38 | ); |
|
39 | } |
|
40 | ||
41 | public function send200Response(Request $request, Response $response, string $path) |
|
42 | { |
|
43 | $response->writeHead(200, [ |
|
44 | 'Content-Type' => 'text/html', |
|
45 | ]); |
|
46 | ||
47 | $this->writeResponse(200, $request->getPath()); |
|
48 | $response->end(file_get_contents($path)); |
|
49 | } |
|
50 | ||
51 | private function writeResponse(int $responseCode, string $path) |
|
52 | { |