Clone the request object, leaving off any response that was received
Guzzle\Plugin\Redirect\RedirectPlugin::cloneRequestWithGetMethod
public function __clone() {
if ($this->eventDispatcher) {
$this->eventDispatcher = clone $this->eventDispatcher;
}
$this->curlOptions = clone $this->curlOptions;
$this->params = clone $this->params;
// Remove state based parameters from the cloned request
$this->params
->remove('curl_handle')
->remove('queued_response')
->remove('curl_multi');
$this->url = clone $this->url;
$this->response = $this->responseBody = null;
// Clone each header
foreach ($this->headers as $key => &$value) {
$value = clone $value;
}
$this
->setState(RequestInterface::STATE_NEW);
$this
->dispatch('request.clone', array(
'request' => $this,
));
}