Пример #1
0
        HttpResponseMessage OnResponse(Task <HttpResponseMessage> responseTask)
        {
            var            resp = responseTask.Result;
            List <dynamic> listeners;

            if (_listeners.TryGetValue("response", out listeners))
            {
                var nodeResponse = new NodeHttpResponse(this, responseTask);
                listeners.ForEach(listener =>
                {
                    if (listener is Action <NodeHttpResponse> )
                    {
                        ((Action <NodeHttpResponse>)listener)(nodeResponse);
                    }
                    else
                    {
                        listener.call(null, nodeResponse);
                    }
                });
                nodeResponse.InitEvents();
            }
            return(resp);
        }
 HttpResponseMessage OnResponse(Task<HttpResponseMessage> responseTask)
 {
     var resp = responseTask.Result;
     List<dynamic> listeners;
     if (_listeners.TryGetValue("response", out listeners))
     {
         var nodeResponse = new NodeHttpResponse(this, responseTask);
         listeners.ForEach(listener =>
         {
             if (listener is Action<NodeHttpResponse>)
             {
                 ((Action<NodeHttpResponse>)listener)(nodeResponse);
             }
             else
             {
                 listener.call(null, nodeResponse);
             }
         });
         nodeResponse.InitEvents();
     }
     return resp;
 }