C# POST请求中raw 参数的传递

public static string PostmanPost()
        {
            var client = new RestClient("http://119.3.248.64:3000");
            var request = new RestRequest(Method.POST);
            request.RequestFormat = DataFormat.Json;
            request.AddHeader("Content-Type", "application/json");
//            request.AddParameter("undefined", "{"ddd":"eee"}", ParameterType.RequestBody);

            Rootobject bean = new Rootobject("console","test");


            request.AddParameter("application/json; charset=utf-8", JsonConvert.SerializeObject(bean), ParameterType.RequestBody);
            IRestResponse response = client.Execute(request);
            var responseContent = response.Content;
            return responseContent;
        }

 

你可能感兴趣的