Skip to content

Commit

Permalink
Merge pull request #89 from mikealmond/hotfix/adhere-to-interface
Browse files Browse the repository at this point in the history
Make AbstractRequest adhere to the RequestInterface
  • Loading branch information
delatbabel committed Jul 14, 2017
2 parents f2857b7 + 480b1a3 commit 26a3341
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions src/Message/AbstractRequest.php
Expand Up @@ -183,22 +183,6 @@ public function getHeaders()
return $headers;
}

/**
* Send the request
*
* @return ResponseInterface
*/
public function send()
{
$data = $this->getData();
$headers = array_merge(
$this->getHeaders(),
array('Authorization' => 'Basic ' . base64_encode($this->getApiKey() . ':'))
);

return $this->sendData($data, $headers);
}

/**
* @param $data
* @param array $headers
Expand Down Expand Up @@ -234,8 +218,16 @@ function ($event) {
return $httpRequest;
}

public function sendData($data, array $headers = null)
/**
* {@inheritdoc}
*/
public function sendData($data)
{
$headers = array_merge(
$this->getHeaders(),
array('Authorization' => 'Basic ' . base64_encode($this->getApiKey() . ':'))
);

$httpRequest = $this->createClientRequest($data, $headers);
$httpResponse = $httpRequest->send();

Expand Down

0 comments on commit 26a3341

Please sign in to comment.