Skip to content

Commit bc87a60

Browse files
committed
Support compress option from config
1 parent 064f9e3 commit bc87a60

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ Example config:
187187
'timeout' => 3,
188188
// the token must match 'upload.token' config in XHGui
189189
'token' => 'token',
190+
// whether to gzip compress the payload
191+
'compress' => true,
190192
),
191193
```
192194

src/Saver/UploadSaver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class UploadSaver implements SaverInterface
1313
/** @var bool */
1414
private $compress;
1515

16-
public function __construct($url, $token, $timeout, $compress = false)
16+
public function __construct($url, $token, $timeout, $compress)
1717
{
1818
$this->url = $url;
1919
if ($token) {

src/SaverFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ public static function create($saveHandler, array $config = array())
3131
'uri' => null,
3232
'token' => null,
3333
'timeout' => 3,
34+
'compress' => false,
3435
);
3536
$userConfig = isset($config['save.handler.upload']) && is_array($config['save.handler.upload']) ? $config['save.handler.upload'] : array();
3637
$saverConfig = array_merge($defaultConfig, $userConfig);
37-
$saver = new Saver\UploadSaver($saverConfig['uri'], $saverConfig['token'], $saverConfig['timeout']);
38+
$saver = new Saver\UploadSaver($saverConfig['uri'], $saverConfig['token'], $saverConfig['timeout'], $saverConfig['compress']);
3839
break;
3940

4041
case Profiler::SAVER_STACK:

0 commit comments

Comments
 (0)