RestShrap Simple REST and HTTP Client for .NET 了解

Recently doing a project, you need to upload files to a file server, a file server is webapi forms of internal interfaces. After a friend recommended restshrap,

example:

//upload files

 var request=new RestClient();

var req = new RestRequest ( "http://www.sc.com", Method.Post); // upload address,

req.addHeader("content-type","multipart/form-data");

req.AddFile ( "file path");

IRestResponse req=client.Execute(req);

var content = req.Content; // Return value

 

Official website: www.restsharp.org 

 

Guess you like

Origin www.cnblogs.com/xgq2014/p/11201275.html