uwp ,win10 post json

public static async Task<HttpResponseMessage> PostHttpstringrequest(string requesturl,string jsonstr)
{
var myClient = new HttpClient();
var myRequest = new HttpRequestMessage(HttpMethod.Post, requesturl);
// HttpContent content = new StringContent(@"{ ""url"": ""http://cili006.com/""}");
HttpContent content = new StringContent(jsonstr);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
// Send a request asynchronously continue when complete 
myRequest.Content = content;
//myRequest.Version = Version.Parse("1.1");

//HttpContent content=
//myRequest.Content=
//// This property represents the client preference for the HTTP protocol version.
//// The default value for UWP apps is 2.0.
//Debug.WriteLine(myRequest.Version.ToString());
var response = await myClient.SendAsync(myRequest);
return response;
//string streamcontent = await response.Content.ReadAsStringAsync();
//return streamcontent;
}
}

上一篇:APP接口自动化测试JAVA+TestNG(一)之框架环境搭建


下一篇:基于visual Studio2013解决C语言竞赛题之1020订票