This commit is contained in:
2024-12-16 15:55:29 +08:00
parent ae20755bd7
commit 34ab8f145c
3 changed files with 663 additions and 660 deletions
-17
View File
@@ -1,17 +0,0 @@
<?php
namespace Kiri\Router\Annotate;
#[\Attribute(((\Attribute::TARGET_METHOD)))]
class ContentType
{
/**
* @param string $contentType
*/
public function __construct(public string $contentType = "text/html")
{
}
}
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace Kiri\Router\Annotate;
use Kiri\Router\ContentType;
#[\Attribute(\Attribute::TARGET_METHOD)]
class ResponseContentType
{
/**
* @param ContentType $contentType
*/
public function __construct(public ContentType $contentType = ContentType::JSON)
{
}
}
+3 -2
View File
@@ -373,6 +373,7 @@ enum ContentType
/**
* @param $method
*
* @return string
*/
public function toString(): string
@@ -496,7 +497,7 @@ enum ContentType
self::PIC => 'application/x-pic',
self::PL => 'application/x-perl',
self::PLT => 'application/x-plt',
self::PNG => 'application/x-png',
self::X_PNG => 'application/x-png',
self::PPA, self::PPS, self::PWZ, self::POT, self::PPT => 'application/vnd.ms-powerpoint',
self::X_PPT => 'application/x-ppt',
self::PRF => 'application/pics-rules',
@@ -641,7 +642,7 @@ enum ContentType
self::ICON => 'image/x-icon',
self::JFIF, self::X_JPE, self::JPEG, self::X_JPG => 'image/jpeg',
self::NET => 'image/pnetvue',
self::X_PNG => 'image/png',
self::PNG => 'image/png',
self::RP => 'image/vnd.rn-realpix',
self::WBMP => 'image/vnd.wap.wbmp',
self::EML, self::MHT, self::MHTML, self::NWS => 'message/rfc822',