webman-framework
webman-framework copied to clipboard
解决请求未经过任何中间件时,请求返回可能不为Response问题
在App::send中调用$connection->send($response),
如果$response不是Response,而是一个实现了__toString()的对象,那么__toString()将被延迟到Workerman\Protocols\Http::encode()中调用,如果__toString()用到了一些wenbman里面的东西,比如使用request(),返回空。 因为是$connection->send()之前调用的Context::destroy();销毁了。