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
ResourceObject should be render (__toString) before looking up headers #1
Comments
But sorry, at first, I don't prefer __toString for Render for |
Agreed. Handler should be handle stream not body string. Your code seems works fine. Would you send PR ? Or I can fixed it later. Thank you for making the issue. |
ok. I would try at this weekend. |
Awesome ! |
sorry for late. I couldn't take a time to catch up lack of BEAR.Sunday knowledge. |
no problem, I will do it later with your code. |
quick fix for header now. |
Fixed !
Now
But things are not easy as first glance. The current implementation has limitation. This version can't handle with your blog post example. (view template produce huge text). Instead, we can assign public function onGet()
{
$this['msg'] = 'hello world';
$this['stream'] = fopen(__DIR__ . '/message.txt', 'r');
return $this;
}
https://github.com/bearsunday/BEAR.Middleware/blob/1.x/src/Module/StreamRenderer.php#L117 If you want single stream without any fixed text, you simple assign stream to entire resource body. public function onGet()
{
$this->body = fopen(__DIR__ . '/message.txt', 'r');
return $this;
} |
@sasezaki I tested with huge text stream, It succeeded but need to change output procedure as you mentioned. |
@sasezaki your blog post are SUPER helpful. (I knew very little about it) |
current ResourceHandler seems have issue for header setting.
Expected result
Actual result
Because, handle() method sets header such as below
I think fix needed like..
The text was updated successfully, but these errors were encountered: