Skip to content

Commit

Permalink
Merge branch 'Machecek-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
hubipe committed May 18, 2020
2 parents 98c91e4 + 0ddaad6 commit ce5ac13
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Request/GuzzleRequestClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ class GuzzleRequestClient extends ObjectPrototype implements IRequestClient
/** @var Client */
private $client;

/** @var array */
private $options;

public function call(IRequest $request): IResponse
{
$serviceUrl = $request->getServiceUrl()->getValue();
if ($request->getFormat() === ResponseFormat::get(ResponseFormat::JSON)) {
$serviceUrl .= '.json';
}

$options = [];
$options = $this->options;
if ($request->getData() !== []
&& $request->getMethod() === HttpMethod::get(HttpMethod::POST)) {
$options[RequestOptions::FORM_PARAMS] = $request->getData();
Expand Down Expand Up @@ -65,5 +68,14 @@ private function getClient(): Client
return $this->client;
}

/**
* @param array $options
*
* Set extra options for HTTP Client
*/
public function setOptions(array $options)
{
$this->options = $options;
}

}

0 comments on commit ce5ac13

Please sign in to comment.