Skip to content

Commit

Permalink
Update AbstractRequest.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Dumkaaa authored Oct 16, 2018
1 parent c73d1c4 commit 37c6bec
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,19 @@ public function sendData($data)
{
$url = $this->getEndPoint() . $this->getMethod();
$this->validate('userName', 'password');
$data = array_merge(
[
'userName' => $this->getUserName(),
'password' => $this->getPassword(),
],
$data
);

$httpResponse = $this->httpClient->request(
$this->getHttpMethod(),
$url,
$this->getHeaders(),
json_encode(array_merge([
'userName' => $this->getUserName(),
'password' => $this->getPassword()
], $data))
http_build_query($data, '', '&')
);

$responseClassName = str_replace('Request', 'Response', \get_class($this));
Expand All @@ -174,7 +179,9 @@ public function sendData($data)
);
}

return $reflection->newInstance($this, json_decode($httpResponse->getBody(true), true));
$content = json_decode($httpResponse->getBody()->getContents(), true);

return $reflection->newInstance($this, $content);
}

/**
Expand Down

0 comments on commit 37c6bec

Please sign in to comment.