final class OptionsMiddleware implements MiddlewareInterface (View source)

Supplies automatic OPTIONS responses when no explicit OPTIONS route owns a path.

Methods

__construct(Router $router, ResponseFactoryInterface $responseFactory)

Initializes automatic OPTIONS handling against the shared route collection.

ResponseInterface
process(ServerRequestInterface $request, RequestHandlerInterface $handler)

Delegates non-OPTIONS and explicit routes, otherwise returns the allowed methods.

ResponseInterface

Details

__construct

__construct(Router $router, ResponseFactoryInterface $responseFactory)

Initializes automatic OPTIONS handling against the shared route collection.

Parameters

Router $router
ResponseFactoryInterface $responseFactory

process

ResponseInterface process(ServerRequestInterface $request, RequestHandlerInterface $handler)

Delegates non-OPTIONS and explicit routes, otherwise returns the allowed methods.

Parameters

ServerRequestInterface $request
RequestHandlerInterface $handler

Return Value

ResponseInterface