private function fetchResumeUri() { $result = null; $body = $this->request->getBody(); if ($body) { $headers = array('content-type' => 'application/json; charset=UTF-8', 'content-length' => $body->getSize(), 'x-upload-content-type' => $this->mimeType, 'x-upload-content-length' => $this->size, 'expect' => ''); foreach ($headers as $key => $value) { $this->request->setHeader($key, $value); } } $response = $this->client->getHttpClient()->send($this->request); $location = $response->getHeader('location'); $code = $response->getStatusCode(); if (200 == $code && true == $location) { return $location; } $message = $code; $body = $response->json(); if (isset($body['error']['errors'])) { $message .= ': '; foreach ($body['error']['errors'] as $error) { $message .= "{$error[domain]}, {$error[message]};"; } $message = rtrim($message, ';'); } $error = "Failed to start the resumable upload (HTTP {$message})"; $this->client->getLogger()->error($error); throw new Google_Exception($error); }