Merge remote-tracking branch 'origin/main'
# Conflicts: # src/Router.php
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Kiri\Router;
|
||||
|
||||
use Kiri\Router\Annotate\AutoController;
|
||||
use Kiri\Router\Base\Controller;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
|
||||
#[AutoController]
|
||||
class OptionsController extends Controller
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function index(): ResponseInterface
|
||||
{
|
||||
return $this->response->withHeaders(['Access-Control-Allow-Headers' => '*',
|
||||
'Access-Control-Request-Method' => '*',
|
||||
'Access-Control-Allow-Origin' => '*'
|
||||
])->html();
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ class Router
|
||||
|
||||
|
||||
/**
|
||||
* @throws
|
||||
* @throws Exception
|
||||
*/
|
||||
public function scan_build_route(): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user