接口请求

 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");

            Myobject bean = new Myobject("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;
        }
posted @ 2021-05-28 16:52  紫心落  阅读(53)  评论(0编辑  收藏  举报