diff --git a/src/Ratchet/Http/Router.php b/src/Ratchet/Http/Router.php index 2cfc5bf..e4aa790 100644 --- a/src/Ratchet/Http/Router.php +++ b/src/Ratchet/Http/Router.php @@ -34,7 +34,7 @@ class Router implements HttpServerInterface { try { $route = $this->_matcher->match($request->getPath()); } catch (MethodNotAllowedException $nae) { - return $this->close($conn, 405); + return $this->close($conn, 405, array('Allow' => $nae->getAllowedMethods())); } catch (ResourceNotFoundException $nfe) { return $this->close($conn, 404); } @@ -91,13 +91,15 @@ class Router implements HttpServerInterface { /** * Close a connection with an HTTP response * @param \Ratchet\ConnectionInterface $conn - * @param int $code HTTP status code + * @param int $code HTTP status code + * @param array $additionalHeaders * @return null */ - protected function close(ConnectionInterface $conn, $code = 400) { - $response = new Response($code, array( + protected function close(ConnectionInterface $conn, $code = 400, array $additionalHeaders = array()) { + $headers = array_merge(array( 'X-Powered-By' => \Ratchet\VERSION - )); + ), $additionalHeaders); + $response = new Response($code, $headers); $conn->send((string)$response); $conn->close();