spiral / framework

High-Performance PHP Framework
https://spiral.dev
MIT License
1.82k stars 89 forks source link

route:list does not handle OPTIONS verb #1096

Open lifewcody opened 8 months ago

lifewcody commented 8 months ago

Description

ListCommand.php:72

For $result[], there is not an OPTIONS, so if your code has an OPTIONS verb route it crashes with

[UnhandledMatchError]
Unhandled match case 'options'

How To Reproduce

#[Route(route: '/test', name: 'test.cors', methods: ['OPTIONS'])]
    public function testCors() {
        return [
            'status' => true
        ];
    }

Additional Info

Q A
Framework Version 3.12
PHP version 8.3
Operating system Alpine