Skip to content

Commit

Permalink
RequestsConnection to support a custom timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
bajb committed Jan 4, 2017
1 parent da25eaf commit 330a07c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Connections/RequestsConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@

class RequestsConnection extends AbstractConnection
{
protected $_timeout = 20;

/**
* @inheritDoc
*/
public function setTimeout($timout = 20)
{
$this->_timeout = $timout;
return $this;
}

/**
* @inheritDoc
*/
Expand All @@ -25,7 +36,7 @@ public function load(IApiRequest $request)
$this->_buildHeaders($req),
$this->_buildData($req),
$req->getMethod(),
$req->getOptions()
array_merge(['timeout' => $this->_timeout], (array)$req->getOptions())
);

$result = $this->_getResult($response);
Expand Down

0 comments on commit 330a07c

Please sign in to comment.