public void Dispose() { Request = null; RequestCallbacks = null; Response = null; Content = null; }
CilHttpRequest( IHttpMessageHandlerRequestCallbacks requestCallbacks, string method, string url) { Request = new HttpRequest(url) { Method = method }; RequestCallbacks = requestCallbacks; Request.OnHeadersReceived = webResponse => CilHttpMessageHandler.AddEvent(() => { Response = new HttpResponse(webResponse); RequestCallbacks.OnHeadersReceived(); }); Request.OnProgress = (current, total) => CilHttpMessageHandler.AddEvent(() => { RequestCallbacks.OnProgress(current, total, (total > 0)); }); Request.OnDoneCallback = content => CilHttpMessageHandler.AddEvent(() => { Content = content; RequestCallbacks.OnDone(); }); Request.OnExeptionCallback = x => CilHttpMessageHandler.AddEvent(() => { RequestCallbacks.OnError(x.Message); }); }
public static CilHttpRequest Create( IHttpMessageHandlerRequestCallbacks requestCallbacks, string method, string url) { return(new CilHttpRequest(requestCallbacks, method, url)); }