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

question : usefullness of the StreamFactoryInterface parameter in the constructor ? #6

Closed
ncou opened this issue Jan 3, 2019 · 2 comments

Comments

@ncou
Copy link

ncou commented Jan 3, 2019

Hi,

Why are you using as parameter a streamfactory ? the response factory should already initialise a blank and writable stream.
So instead of creating a new body and inject it in the response, you can simply use the one in the new response.

https://github.com/middlewares/error-handler/blob/master/src/ErrorHandler.php#L78

you can simply do something like :

$response->getBody()->write($formatter->format($e));

Am i missing something ?

@oscarotero
Copy link
Member

I'm agree with you. In fact, there's a conversation about this topic: https://github.com/middlewares/error-handler/pull/5/files#r227117082

@ncou
Copy link
Author

ncou commented Jan 5, 2019

Thank you, i didn't see this PR. I have added my opinion in this topic.

@ncou ncou closed this as completed Jan 5, 2019
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