Skip to content

Commit

Permalink
不绑定JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
xutl committed Feb 1, 2018
1 parent 6c6c687 commit b01779e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ApiGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use yii\base\InvalidConfigException;
use yii\httpclient\Client;
use yii\httpclient\RequestEvent;
use yii\httpclient\Response;

/**
* Class ApiGateway
Expand Down Expand Up @@ -60,7 +61,6 @@ public function init()
if (empty ($this->secretKey)) {
throw new InvalidConfigException ('The "secretKey" property must be set.');
}
$this->responseConfig['format'] = Client::FORMAT_JSON;
$this->on(Client::EVENT_BEFORE_SEND, [$this, 'RequestEvent']);
}

Expand Down Expand Up @@ -94,7 +94,7 @@ public function RequestEvent(RequestEvent $event)
* @param array|string $data
* @param array $headers
* @param array $options
* @return array response data.
* @return Response response data.
* @throws Exception
*/
public function sendRequest($method, $url, $data, $headers, $options)
Expand All @@ -113,6 +113,6 @@ public function sendRequest($method, $url, $data, $headers, $options)
if (!$response->isOk) {
throw new Exception('Request fail. response: ' . $response->content, $response->statusCode);
}
return $response->data;
return $response;
}
}

0 comments on commit b01779e

Please sign in to comment.