diff --git a/README.md b/README.md index bfaed64..2239c10 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,8 @@ Example config: 'timeout' => 3, // the token must match 'upload.token' config in XHGui 'token' => 'token', + // whether to gzip compress the payload + 'compress' => true, ), ``` diff --git a/src/Saver/UploadSaver.php b/src/Saver/UploadSaver.php index 188e28b..f05743d 100644 --- a/src/Saver/UploadSaver.php +++ b/src/Saver/UploadSaver.php @@ -13,7 +13,7 @@ class UploadSaver implements SaverInterface /** @var bool */ private $compress; - public function __construct($url, $token, $timeout, $compress = false) + public function __construct($url, $token, $timeout, $compress) { $this->url = $url; if ($token) { diff --git a/src/SaverFactory.php b/src/SaverFactory.php index 9a0dd6f..5d22b11 100644 --- a/src/SaverFactory.php +++ b/src/SaverFactory.php @@ -32,10 +32,11 @@ public static function create($saveHandler, array $config = array()) 'url' => null, 'token' => null, 'timeout' => 3, + 'compress' => false, ); $userConfig = isset($config['save.handler.upload']) && is_array($config['save.handler.upload']) ? $config['save.handler.upload'] : array(); $saverConfig = array_merge($defaultConfig, $userConfig); - $saver = new Saver\UploadSaver($saverConfig['url'] ?: $saverConfig['uri'], $saverConfig['token'], $saverConfig['timeout']); + $saver = new Saver\UploadSaver($saverConfig['url'] ?: $saverConfig['uri'], $saverConfig['token'], $saverConfig['timeout'], $saverConfig['compress']); break; case Profiler::SAVER_STACK: