Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispatcher can implement RequestHandlerInterface #16

Closed
Sevavietl opened this issue Mar 1, 2019 · 3 comments
Closed

Dispatcher can implement RequestHandlerInterface #16

Sevavietl opened this issue Mar 1, 2019 · 3 comments

Comments

@Sevavietl
Copy link
Contributor

Hi. Thank you for the great libraries.

What do you think about making Middlewares\Utils\Dispatcher to implement Psr\Http\Server\RequestHandlerInterface?

Dispatcher already has method dispatch(ServerRequestInterface $request): ResponseInterface, that, except the name, resemble handle(ServerRequestInterface $request): ResponseInterface from 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.

@oscarotero
Copy link
Member

Yes, why not.
Your PR is welcome! 👍

@Sevavietl
Copy link
Contributor Author

@oscarotero thank you for merging PR. Can you, please, make a new patch release?

@oscarotero
Copy link
Member

Sorry for the late. New version released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants