代码:
var today = new Token(); X.Component.Tools.WebClient wc = new Component.Tools.WebClient(); wc.RequestHeaders.Add("Accept", "application/vnd.api+json"); wc.RequestHeaders.Add("Content-Type", "application/vnd.api+json"); wc.RequestHeaders.Add("Authorization", today.access_token); var result = wc.Post(Config.ApiUrl, data);
HttpWebRequest 有专门的 Accept 属性,只能通过它修改 Accept 请求头