diff --git a/src/Constrict/ConstrictResponse.php b/src/Constrict/ConstrictResponse.php index a5cbe77..2bdb31f 100644 --- a/src/Constrict/ConstrictResponse.php +++ b/src/Constrict/ConstrictResponse.php @@ -76,7 +76,7 @@ class ConstrictResponse extends Message implements ResponseInterface * @param int $statusCode * @return $this */ - public function html(string $content, int $statusCode = 200): static + public function html(string $content = '', int $statusCode = 200): static { $this->getBody()->write($content); return $this->withContentType(ContentType::HTML)->withStatus($statusCode); diff --git a/src/OptionsController.php b/src/OptionsController.php new file mode 100644 index 0000000..6d38aae --- /dev/null +++ b/src/OptionsController.php @@ -0,0 +1,26 @@ +response->withHeaders(['Access-Control-Allow-Headers' => '*', + 'Access-Control-Request-Method' => '*', + 'Access-Control-Allow-Origin' => '*' + ])->html(); + } + +} \ No newline at end of file diff --git a/src/Response.php b/src/Response.php index 417fcb5..beb10d9 100644 --- a/src/Response.php +++ b/src/Response.php @@ -89,7 +89,7 @@ class Response implements ResponseInterface * @param int $statusCode * @return ResponseInterface */ - public function html(string $content, int $statusCode = 200): ResponseInterface + public function html(string $content = '', int $statusCode = 200): ResponseInterface { return $this->__call__(__FUNCTION__, $content, $statusCode); } diff --git a/src/Router.php b/src/Router.php index af2bded..adfc212 100644 --- a/src/Router.php +++ b/src/Router.php @@ -171,7 +171,7 @@ class Router /** - * @throws + * @throws Exception */ public function scan_build_route(): void {