Exemplo n.º 1
0
 /**
  * 
  * @param Irto\OAuth2Proxy\ProxyResponse $response
  * @param Closure $next
  * 
  * @return Irto\OAuth2Proxy\ProxyResponse
  */
 public function response($response, Closure $next)
 {
     $original = $response->clientResponse();
     $original->on('data', function ($data) use($response, $original) {
         $response->write($data);
         if ($response->dataLength() === (int) $response->headers()->get('content-length', -1)) {
             $original->close();
         }
     });
     $original->on('end', function () use($response) {
         $response->end();
     });
     return $next($response);
 }