简体   繁体   中英

response always null restsharp

I use restsharp for post data and then return some single value after post completion but it response always get null.

public static IRestResponse Services(Object obj)
    {
        var client = new RestClient("http://192.168.1.5/OpManWeb.ServiceHost/api");

            var request = new RestRequest("/SaveExternalOrder/", Method.POST);
            var json = JsonConvert.SerializeObject(obj, Formatting.None,
                new JsonSerializerSettings()
                {
                    ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                });
            request.AddParameter("text/json", json, ParameterType.RequestBody);
            var response = client.Execute(request);
            return response;
    }

使用提琴手检查restsharp生成的请求是否像您想要的那样。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM