HTTP client extension version 2.0.1 released

Aug 4, 2016

We are very pleased to announce the release of HTTP client extension version 2.0.1 which brings 10 enhancements and bug fixes. See CHANGELOG for details. The most signiifcant change is introduction of beforeSend and afterSend events for the HTTP request:

use yii\httpclient\Client;
use yii\httpclient\Request;
use yii\httpclient\RequestEvent;
$client = new Client();
$request = $client->createRequest()
    ->setData(['param' => 'value']);
// Ensure signature generation based on final data set:
$request->on(Request::EVENT_BEFORE_SEND, function (RequestEvent $event) {
    $data = $event->request->getData();
    $signature = md5(http_build_query($data));
    $data['signature'] = $signature;
// Normalize response data:
$request->on(Request::EVENT_AFTER_SEND, function (RequestEvent $event) {
    $data = $event->response->getData();
    $data['content'] = base64_decode($data['encoded_content']);
$response = $request->send();

Please refer to documentation for more details.