📜  内容类型应用程序json c#代码示例

📅  最后修改于: 2022-03-11 14:49:02.697000             🧑  作者: Mango

代码示例1
var url = new Uri("");  // url to make post request to
var json = "";  // json to post

// create string content with MediaTypeHeaderValue
var stringContent = new StringContent(partialSnackerJson)
{
  Headers =
  {
    ContentType = new MediaTypeHeaderValue("application/json")
   }
};

// make http request
var response = await client.PostAsync(url, stringContent);