Hapikit.TaskExtensions.ApplyRepresentationToAsync C# (CSharp) Méthode

ApplyRepresentationToAsync() public static méthode

public static ApplyRepresentationToAsync ( this task, IResponseHandler responseHandler ) : Task
task this
responseHandler IResponseHandler
Résultat Task
        public static async Task<HttpResponseMessage> ApplyRepresentationToAsync(this Task<HttpResponseMessage> task, IResponseHandler responseHandler)
        {
            // What do we do with exceptions that happen here?               
            
            HttpResponseMessage response = await task;
            if (task.IsCompleted && responseHandler != null)
            {
                response = task.Result;
                string lr = "related";
                if (response.RequestMessage.Properties.ContainsKey(HttpClientExtensions.PropertyKeyLinkRelation))
                {
                    lr = response.RequestMessage.Properties[HttpClientExtensions.PropertyKeyLinkRelation] as string;
                }
                response = await responseHandler.HandleResponseAsync(lr, response);
            }
            return response;
            
        }
    }