Closed Sevavietl closed 5 years ago
Hi. Thank you for the great libraries.
What do you think about making Middlewares\Utils\Dispatcher to implement Psr\Http\Server\RequestHandlerInterface?
Middlewares\Utils\Dispatcher
Psr\Http\Server\RequestHandlerInterface
Dispatcher already has method dispatch(ServerRequestInterface $request): ResponseInterface, that, except the name, resemble handle(ServerRequestInterface $request): ResponseInterface from RequestHandlerInterface.
Dispatcher
dispatch(ServerRequestInterface $request): ResponseInterface
handle(ServerRequestInterface $request): ResponseInterface
RequestHandlerInterface
Making Dispatcher a middleware composite enables to pass it to some runners, for example zendframework/zend-httphandlerrunner:
$runner = new RequestHandlerRunner( $container->get(ApplicationRequestHandler::class), $container->get(EmitterStack::class), $container->get('ServerRequestFactory'), $container->get('ServerRequestErrorResponseGenerator') ); $runner->run();
What do you think about this?
I have tested such approach localy, so can provide PR if needed.
Thak you in advance.
Yes, why not. Your PR is welcome! 👍
@oscarotero thank you for merging PR. Can you, please, make a new patch release?
Sorry for the late. New version released.
Hi. Thank you for the great libraries.
What do you think about making
Middlewares\Utils\Dispatcher
to implementPsr\Http\Server\RequestHandlerInterface
?Dispatcher
already has methoddispatch(ServerRequestInterface $request): ResponseInterface
, that, except the name, resemblehandle(ServerRequestInterface $request): ResponseInterface
fromRequestHandlerInterface
.Making
Dispatcher
a middleware composite enables to pass it to some runners, for example zendframework/zend-httphandlerrunner:What do you think about this?
I have tested such approach localy, so can provide PR if needed.
Thak you in advance.