public static ReactivixHTTPPacket ForGET() { ReactivixHTTPPacket packet = new ReactivixHTTPPacket(); packet.Method = METHOD_GET; return(packet); }
public static ReactivixHTTPPacket ForMethod(string method, object data = null) { ReactivixHTTPPacket packet = new ReactivixHTTPPacket(); packet.Method = method; packet.Data = data; return(packet); }
public static ReactivixHTTPPacket ForPOST(object data) { ReactivixHTTPPacket packet = new ReactivixHTTPPacket(); packet.Method = METHOD_POST; packet.Data = data; return(packet); }
public void SendRequest <TResponse>(string uri, ReactivixHTTPPacket request, ReactivixHTTPPacket response, Action <ReactivixHTTPPacket> onResponse = null, Action <Exception> onError = null) { ReactivixURI URI = ReactivixURI.FromURI(uri); if (URI.Port == 0) { if (URI.Scheme == SCHEME_HTTP) { URI.Port = PORT_HTTP; } if (URI.Scheme == SCHEME_HTTPS) { URI.Port = PORT_HTTPS; } } if (request.Processor == null) { request.Processor = new ReactivixFormIOProcessor(); } if (response.Processor == null) { response.Processor = new ReactivixPlainIOProcessor(); } request.URI = URI; request.Headers.Add(new KeyValuePair <string, string>("Accept", response.Processor.MIME)); response.URI = URI; response.DataType = typeof(TResponse); _tasks.Add(new ReactivixHTTPClientTask { OnResponse = onResponse, OnError = onError, Request = request.Copy(), Response = response.Copy() }); }