public static Task <string> GetStringAsync(Uri uri, RequestParams request) { return(DoRequest((client) => { if (request.Method == HTTPRequestMethod.GET && !request.HasBody) { return client.DownloadStringTaskAsync(uri); } if (request.Method == HTTPRequestMethod.POST) { return client.UploadStringTaskAsync(uri, request.GetBody()); } return client.UploadStringTaskAsync(uri, request.Method.ToString(), request.GetBody()); }, request).ContinueWith((antecedent) => Uri.UnescapeDataString(antecedent.Result))); }
public static string GetString(Uri uri, RequestParams request) { return(Uri.UnescapeDataString(DoRequest((client) => { if (request.Method == HTTPRequestMethod.GET && !request.HasBody) { return client.DownloadString(uri); } if (request.Method == HTTPRequestMethod.POST) { return client.UploadString(uri, request.GetBody()); } return client.UploadString(uri, request.Method.ToString(), request.GetBody()); }, request))); }