diff --git a/src/RestClient.php b/src/RestClient.php index 0eb4829dccb8f9a5afa21fe9224915468c712b86..3798c2fa28245f729d7443db8c1b2681728e39a7 100644 --- a/src/RestClient.php +++ b/src/RestClient.php @@ -593,10 +593,15 @@ class RestClient { // On update, upsert method returns an empty body. Retreive object id, so that we can return a consistent response. if ($this->response->getStatusCode() == 204) { + // We need a way to allow callers to distinguish updates and inserts. To + // that end, cache the original response and reset it after fetching the + // ID. + $response = $this->response; $sf_object = $this->objectReadbyExternalId($name, $key, $value); $data['id'] = $sf_object['Id']; $data['success'] = TRUE; $data['errors'] = []; + $this->response = $response; } return $data;