From cd056f5f4f3fec1db8842165797bbe4bbdd2f34d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 16 Dec 2020 16:05:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HttpServer/Events/OnRequest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/HttpServer/Events/OnRequest.php b/HttpServer/Events/OnRequest.php index 86173c13..f38c08ac 100644 --- a/HttpServer/Events/OnRequest.php +++ b/HttpServer/Events/OnRequest.php @@ -53,6 +53,10 @@ class OnRequest extends Callback public function onRequest(Request $request, Response $response) { try { + if ($request->header['request_method'] === 'OPTIONS') { + $response->status(200); + return $response->end(); + } /** @var HRequest $sRequest */ [$sRequest, $sResponse] = [HRequest::create($request), HResponse::create($response)]; if ($sRequest->is('favicon.ico')) {