public void GetFile(Uri uri, Action<byte[], Exception> callback) { var client = new HttpClient(this.executeCallbackOnUiThread) { Credentials = this.credentials }; client.Url = BuildUrl(uri); client.Get(response => { if (response.ResponseStatus == ResponseStatus.Error) { callback(null, response.ErrorException); } else { callback(response.RawBytes, null); } }); }
public void Get_GoogleStartPage() { var http = new HttpClient(); http.Url = new Uri("http://www.google.com"); bool done = false; http.Get(r => { Assert.AreEqual(218, r.ContentLength); done = true; }); this.EnqueueConditional(() => done); this.EnqueueTestComplete(); }