get() public method

get info from remote server
public get ( string pUrl, string>.Dictionary pHeaders, CompletionHandler pCompletionHandler ) : void
pUrl string
pHeaders string>.Dictionary
pCompletionHandler CompletionHandler
return void
コード例 #1
0
ファイル: HttpManager2Test.cs プロジェクト: qiniu/csharp-sdk
 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);
 }
コード例 #2
0
 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;
 }