walkor github的方式有個bug
1、有問題的使用方式:
class Response extends \Webman\Http\Response
{
public function __construct($status = 200, array $headers = array(), $body = '')
{
$headers += ['Content-Encoding' => 'gzip'];
$body = gzencode($body);
parent::__construct($status, $headers, $body);
}
public function withBody($body)
{
$body = gzencode($body);
return parent::withBody($body);
}
}
2、具體問題點如下:
請求/plugin/webman/push/push.js時,前端無法接收到push.js內(nèi)容
您可以試一下,不用gzip方法是沒問題的
另外,其他的js請求是正常的
請求/plugin/webman/push/push.js時,執(zhí)行了gzip的構(gòu)造函數(shù),但是沒有執(zhí)行withBody函數(shù)
return response()->file(base_path().'/vendor/webman/push/src/push.js');
改成
return response()->withBody(file_get_contents(base_path().'/vendor/webman/push/src/push.js'));