private HttpRequestNode CreateReq(IHttpRequestData reqData) { var req = CreateRequestNode(reqData); req.Setup(reqData); return(req); }
public WWWRequetNode(IHttpRequestData req) { var dh = req.DataAndHeader; var headers = (System.Collections.Generic.Dictionary <string, string>)dh["header"]; foreach (var kv in req.Headers) { if (headers.ContainsKey(kv.Key)) { headers[kv.Key] = kv.Value; } else { headers.Add(kv.Key, kv.Value); } } www = new WWW(req.URL, (byte[])dh["data"], headers); }
public WWWRequetNode(IHttpRequestData req) { Hashtable dh = req.DataAndHeader; Dictionary <string, string> headers = (Dictionary <string, string>)dh["header"]; foreach (KeyValuePair <string, string> kv in req.Headers) { if (headers.ContainsKey(kv.Key)) { headers[kv.Key] = kv.Value; } else { headers.Add(kv.Key, kv.Value); } } www = new WWW(req.URL, (byte[])dh["data"], headers); }
public override void Setup(IHttpRequestData requestData) { }
protected override HttpRequestNode CreateRequestNode(IHttpRequestData req) { return(new WWWRequetNode(req)); }
public override void Setup(IHttpRequestData requestData) { request.url = requestData.URL; switch (requestData.Method) { case HttpMethod.Get: request.method = UnityWebRequest.kHttpVerbGET; break; case HttpMethod.Post: request.method = UnityWebRequest.kHttpVerbPOST; break; case HttpMethod.Put: request.method = UnityWebRequest.kHttpVerbPUT; break; case HttpMethod.Delete: request.method = UnityWebRequest.kHttpVerbDELETE; break; } if (requestData.Method != HttpMethod.Get && requestData.Method != HttpMethod.Head) { var dh = requestData.DataAndHeader; request.uploadHandler = new UploadHandlerRaw((byte[])dh["data"]); System.Collections.Generic.Dictionary <string, string> formHeaders = (System.Collections.Generic.Dictionary <string, string>)dh["header"]; if (formHeaders.ContainsKey("Content-Type")) { request.uploadHandler.contentType = formHeaders["Content-Type"]; } } else { request.uploadHandler = null; } if (requestData.Method != HttpMethod.Head) { switch (requestData.ResponseType) { case ResponseType.Text: request.downloadHandler = new DownloadHandlerBuffer(); break; case ResponseType.ReadableTexture: case ResponseType.Texture: request.downloadHandler = new DownloadHandlerTexture(requestData.ResponseType == ResponseType.ReadableTexture); break; } } var headers = new System.Collections.Generic.Dictionary <string, string> (requestData.Headers); if (headers != null) { headers.Remove("Content-Type"); foreach (var kv in headers) { request.SetRequestHeader(kv.Key, kv.Value); } } }
protected override HttpRequestNode CreateRequestNode(IHttpRequestData requestData) { return(new RequestNode()); }
protected abstract HttpRequestNode CreateRequestNode(IHttpRequestData requestData);
public abstract void Setup(IHttpRequestData requestData);