code: protected function restoreResponse($response, $data)
      {
          if (isset($data['format'])) {
              $response->format = $data['format'];
          }
          if (isset($data['version'])) {
              $response->version = $data['version'];
          }
          if (isset($data['statusCode'])) {
              $response->statusCode = $data['statusCode'];
          }
          if (isset($data['statusText'])) {
              $response->statusText = $data['statusText'];
          }
          if (isset($data['headers']) && is_array($data['headers'])) {
              $headers = $response->getHeaders()->toArray();
              $response->getHeaders()->fromArray(array_merge($data['headers'], $headers));
          }
          if (isset($data['cookies']) && is_array($data['cookies'])) {
              $cookies = $response->getCookies()->toArray();
              $response->getCookies()->fromArray(array_merge($data['cookies'], $cookies));
          }
      }
docs: Restores response properties from the given data
  @param Response $response the response to be restored
  @param array $data the response property data
  @since 2.0.3