Skip to content

Commit

Permalink
Prepare for RC1 (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm authored Feb 2, 2019
1 parent ab28eef commit e2645a7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

The change log shows what have been Added, Changed, Deprecated and Removed between versions.

## 1.0.0-beta3
## 1.0.0-rc1

### Added

- Support for HTTP/2 server push.
- Option `expose_curl_info` has been added to expose curl metadata information
- Added `CallbackException` for Curl clients.

### Changed

Expand Down
14 changes: 6 additions & 8 deletions lib/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,9 @@ private function createMiddlewareChain(array $middleware, callable $requestChain
$responseChainNext = $responseChainLast;

// Build response chain
/** @var MiddlewareInterface $middleware */
foreach ($middleware as $middleware) {
$lastCallable = function (RequestInterface $request, ResponseInterface $response) use ($middleware, $responseChainNext) {
return $middleware->handleResponse($request, $response, $responseChainNext);
foreach ($middleware as $m) {
$lastCallable = function (RequestInterface $request, ResponseInterface $response) use ($m, $responseChainNext) {
return $m->handleResponse($request, $response, $responseChainNext);
};

$responseChainNext = $lastCallable;
Expand All @@ -183,10 +182,9 @@ private function createMiddlewareChain(array $middleware, callable $requestChain

// Build request chain
$requestChainNext = $requestChainLast;
/** @var MiddlewareInterface $middleware */
foreach ($middleware as $middleware) {
$lastCallable = function (RequestInterface $request) use ($middleware, $requestChainNext) {
return $middleware->handleRequest($request, $requestChainNext);
foreach ($middleware as $m) {
$lastCallable = function (RequestInterface $request) use ($m, $requestChainNext) {
return $m->handleRequest($request, $requestChainNext);
};

$requestChainNext = $lastCallable;
Expand Down
12 changes: 6 additions & 6 deletions lib/Client/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ public function sendRequest(RequestInterface $request, array $options = []): Res
try {
curl_exec($curl);
$this->parseError($request, curl_errno($curl), $curl);
$curlInfo = curl_getinfo($curl);

if ($options->get('expose_curl_info')) {
$curlInfo = curl_getinfo($curl);
}
} finally {
$this->releaseHandle($curl);
}

$response = $responseBuilder->getResponse();
if ($options->get('expose_curl_info', false)) {
$value = json_encode($curlInfo);
if (false !== $value) {
$response = $response->withHeader('__curl_info', $value);
}
if (null !== $curlInfo && $value = json_encode($curlInfo)) {
$response = $response->withHeader('__curl_info', $value);
}

return $response;
Expand Down

0 comments on commit e2645a7

Please sign in to comment.