Does RestSharp overwrite manually set Content-Type?

前端 未结 2 1085
感情败类
感情败类 2020-12-30 03:34

I\'m creating a RestSharp.RestRequest via:

RestRequest request = new RestRequest();
request.Method = Method.POST;
request.Resource = \"/rest-uri\";

request.         


        
2条回答
  •  我在风中等你
    2020-12-30 03:57

    It is possible changing Content-Type when you set the body content. The NAME parameter for Body sets the Content-Type.

    oRequest.Parameters.Add(new Parameter() { Name = "application/json;charset=UTF-8", Type = ParameterType.RequestBody, Value = sBody });
    

提交回复
热议问题