Skip to content

Commit 3729e1e

Browse files
committed
Support compress option from config
1 parent efb6b7c commit 3729e1e

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
@@ -169,6 +169,8 @@ Example config:
169169
'timeout' => 3,
170170
// the token must match 'upload.token' config in XHGui
171171
'token' => 'token',
172+
// whether to gzip compress the payload
173+
'compress' => true,
172174
),
173175
```
174176

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
@@ -32,10 +32,11 @@ public static function create($saveHandler, array $config = array())
3232
'url' => null,
3333
'token' => null,
3434
'timeout' => 3,
35+
'compress' => false,
3536
);
3637
$userConfig = isset($config['save.handler.upload']) && is_array($config['save.handler.upload']) ? $config['save.handler.upload'] : array();
3738
$saverConfig = array_merge($defaultConfig, $userConfig);
38-
$saver = new Saver\UploadSaver($saverConfig['url'] ?: $saverConfig['uri'], $saverConfig['token'], $saverConfig['timeout']);
39+
$saver = new Saver\UploadSaver($saverConfig['url'] ?: $saverConfig['uri'], $saverConfig['token'], $saverConfig['timeout'], $saverConfig['compress']);
3940
break;
4041

4142
case Profiler::SAVER_STACK:

0 commit comments

Comments
 (0)