public get ( string pUrl, string>.Dictionary |
||
pUrl | string | |
pHeaders | string>.Dictionary | |
pCompletionHandler | CompletionHandler | |
return | void |
public void reqGetTest() { HttpManager target = new HttpManager(); string url = "http://ip.taobao.com/service/getIpInfo.php?ip=100.123.199.44"; Dictionary<string, string> pHeaders = new Dictionary<string, string>(); pHeaders.Add("X-Reqid", "TestReqId"); CompletionHandler pCompletionHandler = new CompletionHandler(delegate(ResponseInfo respInfo, string response) { Assert.AreEqual(respInfo.StatusCode, 200); }); target.get(url, pHeaders, pCompletionHandler); }
public StatResult stat(string bucket, string key) { StatResult statResult = null; string url = string.Format("{0}{1}", Config.RS_HOST, statOp(bucket, key)); string token = Auth.createManageToken(url, null, this.mac); HttpManager httpManager = new HttpManager(); httpManager.setAuthHeader(token); httpManager.CompletionHandler = new CompletionHandler(delegate(ResponseInfo respInfo, string response) { if (respInfo.isOk()) { statResult = StringUtils.jsonDecode<StatResult>(response); } else { statResult = new StatResult(); } statResult.Response = response; statResult.ResponseInfo = respInfo; }); httpManager.get(url); return statResult; }