diff --git a/src/NetCoreForce.Client/ForceClient.cs b/src/NetCoreForce.Client/ForceClient.cs index f8bea80..5764891 100644 --- a/src/NetCoreForce.Client/ForceClient.cs +++ b/src/NetCoreForce.Client/ForceClient.cs @@ -597,14 +597,15 @@ public async Task GetObjectBasicInfo(string objectTypeName) /// Use the SObject Describe resource to retrieve all the metadata for an object, including information about each field, URLs, and child relationships. /// /// SObject name, e.g. Account + /// Example If-Modified-Since: Wed, 3 Jul 2013 19:43:31 GMT /// Returns SObjectMetadataAll with full object meta including field metadata - public async Task GetObjectDescribe(string objectTypeName) + public async Task GetObjectDescribe(string objectTypeName, Dictionary customHeaders = null) { var uri = UriFormatter.SObjectDescribe(InstanceUrl, ApiVersion, objectTypeName); JsonClient client = new JsonClient(AccessToken, _httpClient); - return await client.HttpGetAsync(uri); + return await client.HttpGetAsync(uri, customHeaders); } /// diff --git a/src/NetCoreForce.Client/JsonClient.cs b/src/NetCoreForce.Client/JsonClient.cs index 7721b0f..e647ead 100644 --- a/src/NetCoreForce.Client/JsonClient.cs +++ b/src/NetCoreForce.Client/JsonClient.cs @@ -192,6 +192,15 @@ private async Task GetResponse(HttpRequestMessage request, Dictionary(string.Empty); } + // returned when header If-Modified-Since used and the object requested wasn't modified since provided date + if (responseMessage.StatusCode == HttpStatusCode.NotModified) + { + if (customHeaders != null && customHeaders.ContainsKey("If-Modified-Since")) + { + return JsonConvert.DeserializeObject(string.Empty); + } + } + //sucessful response, skip deserialization of response content if (responseMessage.IsSuccessStatusCode && !deserializeResponse) {