Skip to content

Commit 330a07c

Browse files
committed
RequestsConnection to support a custom timeout
1 parent da25eaf commit 330a07c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Connections/RequestsConnection.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111

1212
class RequestsConnection extends AbstractConnection
1313
{
14+
protected $_timeout = 20;
15+
16+
/**
17+
* @inheritDoc
18+
*/
19+
public function setTimeout($timout = 20)
20+
{
21+
$this->_timeout = $timout;
22+
return $this;
23+
}
24+
1425
/**
1526
* @inheritDoc
1627
*/
@@ -25,7 +36,7 @@ public function load(IApiRequest $request)
2536
$this->_buildHeaders($req),
2637
$this->_buildData($req),
2738
$req->getMethod(),
28-
$req->getOptions()
39+
array_merge(['timeout' => $this->_timeout], (array)$req->getOptions())
2940
);
3041

3142
$result = $this->_getResult($response);

0 commit comments

Comments
 (0)